Personnalisation avancée > Services and Infrastructure Customization > Creating Large Objects (LOBs) > Modeling Large Objects > Reading and Writing LOBs
  
Reading and Writing LOBs
BLOBs are either read or written as byte arrays or as Serialized objects each time the object containing the BLOB is read, created, or updated. If the BLOB is modeled using LobLocator, then only the LOB locator is retrieved with each read/write and a second step is required to retrieve or store the LOB. The StandardPersistenceManager provides getLob() and updateLob() to perform these operations.
Be careful about the types of objects that you serialize into the database. Using default Java serialization is especially prone to breaking if the Java class files are recompiled with possible changes, or sometimes just with different compilers. Programming to allow upward compatibility of serialized representations is difficult. One technique is as follows:
1. Make the class Externalizable, which aids performance as well.
2. Specify a fixed serialVersionUID value.
3. Put an internal version number on the object stream and handle version changes in code.
See the code-generated Externalizable business classes for an example of this technique. The disadvantage is that all subclasses are now Externalizable and require readExternal and writeExternal methods. You can use the same type of technique with Serializable (fix serialVersionUID and implement read/writeObject) if independence from the class hierarchy is important.