Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » (no subject)
(no subject) [message #683328] Mon, 13 June 2011 14:15 Go to next message
William Korb is currently offline William KorbFriend
Messages: 7
Registered: January 2011
Junior Member
I am working with a SQL Server 2008 database which has a table that includes a field of type "image" (which EclipseLink recognizes as a LOB).

I used the NetBeans "create entity from database" wizard to generate the class that models this table, and the generated information for this LOB field looked like this:
@Basic(optional = false)
@Column(name = "ORDER_DATA")
private Serializable orderData;
The LOB field happens to be a complex serialized Java object, so when the EL runtime loads this table and gets to this field, it tries to deserialize the entire field. As such, the classes for all of the constituent fields of the serialized object are required to be on my classpath. The JARs required to satisfy this requirement are numerous and large.

The data in this field is something that I would really never do anything with, so having this requirement for my classpath adds lots of unnecessary complexity to the project as well as a dependency on an external project that I have no control over.

My first thought was to force this field to be lazy loaded, thinking that if the RT did not load this field, it would not discover that it needed these other classes and I could just leave them off of my classpath. As such, I modified my mapping as such:
@Basic(optional = false, fetch=FetchType.LAZY)
@Column(name = "ORDER_DATA")
private Serializable orderData;
I then removed the jars for the classes contained in this column from my classpath, but when I attempt to load a record from the database, it complains:
Local Exception Stack:
Exception [EclipseLink-66] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Could not deserialize object from byte array.
Internal Exception: Exception [EclipseLink-3007] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [com.whatever.SomeClass], of class [class java.lang.String], could not be converted to [class java.lang.Class]. Ensure that the class [com.whatever.SomeClass] is on the CLASSPATH. You may need to use alternate API passing in the appropriate class loader as required, or setting it on the default ConversionManager
Internal Exception: java.lang.ClassNotFoundException: com.whatever.SomeClass
What am I missing here? How can I tell the EL runtime to completely disregard this field?

(no subject) [message #683342 is a reply to message #683328] Mon, 13 June 2011 14:43 Go to previous message
Gordon Yorke is currently offline Gordon YorkeFriend
Messages: 78
Registered: July 2009
If this Entity will not need access to this column then simply remove the attribute from your Entity. Not all columns need to be mapped in your Entity, any can be safely ignored.
Previous Topic:(no subject)
Next Topic:Lob field fetch=FetchType.LAZY being ignored
Goto Forum:

Current Time: Sat Apr 17 16:00:52 GMT 2021

Powered by FUDForum. Page generated in 0.02253 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top