text: Eclipse Community Forums - RDF feed Eclipse Community Forums Handling files using lob in entity <![CDATA[This is my situation. I want to store @lob in another entity class so that they wont get loaded when i load my entity class ( I know about lazy loading option but cannot use that option). Then maybe i can link a lob in this way without eagerly loading it. @Entity public class myClass { String fileClassId; } @Entity public class FileClass { @id String id; @lob byte[ ] mylob; } But the problem with this approach is no foreign key relationship is established between 'fileClassId' and 'id' . Is there any way to establish it, without causing mylob to load eagerly ? ( and..Lazy loading is not an option for me) Thanks in advance]]> Arun Joy 2010-11-10T17:29:24-00:00 Re: Handling files using lob in entity <![CDATA[You should just define a OneToOne to the lob entity. @Entity public class MyClass { @OneToOne(fetch=LAZY) FileClass fileClass; } Otherwise you will need to query for the lob directly. If you are just talking about schema creation, then you can add the foreign key constraint yourself, such as in a SessionCustomizer, or your own ddl scripts. ]]> James Sutherland 2010-11-11T15:55:33-00:00