Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Handling files using lob in entity(Handling files using lob in entity)
Handling files using lob in entity [message #638290] Wed, 10 November 2010 12:29 Go to next message
Arun Joy is currently offline Arun Joy
Messages: 10
Registered: July 2010
Junior Member
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
Re: Handling files using lob in entity [message #638556 is a reply to message #638290] Thu, 11 November 2010 10:55 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

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 : Wiki : Book : Blog : Twitter
Previous Topic:Support for XML column types?
Next Topic:Bug on using pagination on Oracle?
Goto Forum:
  


Current Time: Thu Jul 31 13:43:33 EDT 2014

Powered by FUDForum. Page generated in 0.02464 seconds