Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] EclipseLink @Lob Implementation DB Limitations

Unfortunately DDL, especially for LOBs is not very well standardized across
different databases.  But your recommendation should be possible, please log
a bug.

The @Column size should be used when specified, and we should be able to
check if it is > the max varchar value and use a CLOB.  For MySQL we should
probably default mapping CLOB to LONGTEXT instead of TEXT.

A workaround may be to use a DescriptorCustomizer or SessionCustomizer to
set the mapping's field dynamically based on the platform.  Or use your own
scripts to generate or alter the schema.


drad wrote:
> 
> I am having an issue with EclipseLink related to LOBs (@Lob). Basically I
> have a sample project which has one class (Person) which has four columns
> (id, firstName, lastName, and datr). The datr column is defined as String
> with the @Lob annotation.
> 
> I have a JUnit test case which loads the above structure with varying size
> info in the datr column. I am using this to test writing large datasets
> into the created datastructure, currently the size varies from around 250
> characters up to 2mb of characters.
> 	
> In order to make this work for derby I discovered I needed to add a column
> definition (e.g. @Column(name="datr", columnDefinition="CLOB(5242880)")  
> //5242880=5mb -> provides for clobs up to 5mb.) annotation to the datr
> element. The next step in my testing was to switch to MySQL for the
> database and test the functionality there, wherein I discovered I needed
> to have a different column definition (e.g. @Column(name="datr",
> columnDefinition="LONGTEXT")   //provides for clobs up to 4294967295
> (4096mb).). 
> 	
> After searching goole I also discovered the length attribute to the
> @Column annotation and would expect this to solve the issue such as:
> 	if I specify a length of 5242880 I would expect the Persistence Provider
> to create the necessary sized Lob on the target db - if this is derby it
> would create a CLOB(5242880), if it is MySQL it would create a LONGTEXT.
> 		
> Am I wrong in expecting this to be one of the key uses of EclipseLink (and
> JPA)?
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/EclipseLink-%40Lob-Implementation-DB-Limitations-tp22230504p22290045.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top