org.rhq.core.domain.content
Class PackageBitsBlob

java.lang.Object
  extended by org.rhq.core.domain.content.PackageBitsBlob
All Implemented Interfaces:
Serializable

public class PackageBitsBlob
extends Object
implements Serializable

The actual Lob contents for a PackageBits entity. Note that PackageBits and PackageBitsBlob are two entities that *share* the same db row. This is done to allow for Lazy load semantics on the Lob. Hibernate does not honor field-level Lazy load on a Lob (or any field) unless the entity class is instrumented. We can't use that approach because it introduces Hibernate imports into the domain class, and that violates our restriction of exposing hibernate classes to the Agent and Remote clients. As a workaround we pull the Lob into its own entity and access it through a relational mapping. Note that the entities share the same Id since they share the same physical row. The row is persisted via this class and as such the sequence is declared here. Creating this entity first allows us to satisfy the required 1-1 mapping in PackageBits.
Related Links:
http://docs.jboss.org/hibernate/stable/core/reference/en/html/performance.html#performance-fetching-lazyproperties
http://community.jboss.org/wiki/Someexplanationsonlazyloadingone-to-one
http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#entity-hibspec-singleassoc
http://community.jboss.org/wiki/AShortPrimerOnFetchingStrategies
http://docs.codehaus.org/display/MAVENUSER/Howto+instrument+domain+model+classes+using+hibernate

See Also:
Serialized Form

Field Summary
static String TABLE_NAME
           
 
Constructor Summary
PackageBitsBlob()
           
 
Method Summary
 byte[] getBits()
          The actual content of the package ("the bits").
 int getId()
           
 void setBits(byte[] bits)
          For large file contents, you should use ContentManager.updateBlobStream() to write and ContentManager.writeBlobOutToStream() to stream the binary bits and avoid a byte[].
 void setId(int id)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLE_NAME

public static final String TABLE_NAME
See Also:
Constant Field Values
Constructor Detail

PackageBitsBlob

public PackageBitsBlob()
Method Detail

getId

public int getId()

setId

public void setId(int id)

getBits

public byte[] getBits()
The actual content of the package ("the bits"). If the package content is not stored in the database, this will return null. In this case, the content is probably stored somewhere else on a local file system. When null is returned, it is assumed that who ever needs the content can know where to find it based on the PackageVersion details. For large file contents, you should use ContentManager.updateBlobStream() to write and ContentManager.writeBlobOutToStream() to read/direct file contents into as no byte[] is used.


setBits

public void setBits(byte[] bits)
For large file contents, you should use ContentManager.updateBlobStream() to write and ContentManager.writeBlobOutToStream() to stream the binary bits and avoid a byte[].



Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.