Quantcast
Channel: SCN : Popular Discussions - SAP HANA Cloud Platform Developer Center
Viewing all articles
Browse latest Browse all 1318

Correct way to deal with @Lob JPA Fields?

$
0
0

Hi,

 

the current Documentation says

Due to the EclipsLink bug 317597, the @Lob annotation is ignored when the corresponding table column is created in the database. In order to enforce the creation of a CLOB column, you have to additionally specify @Column(length=4001) for the property concerned. In fact, any value may be chosen as long as it is at least 4001 for SAP MaxDB or 2001 for the SAP HANA database.

 

´This seems to indicate that you simply need to specify the length and everything will be fine. Unfortunately this does not seem to be true. With "@Lob @Column(length = 20971520)" for a byte[] "BLOB(20971520)" is generated, which the MaxDB used in hanatrial.ondemand.com does not like (Internal Exception: com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "("). This is without an eclipselink.target-database entry in persistence.xml, in which case according to the log "org.eclipse.persistence.platform.database.DatabasePlatform" is used. I also tried "org.eclipse.persistence.platform.database.MaxDBPlatform" as eclipselink.target-database, which unfortunatly resulted in column definitions for String as "VARCHAR(255) UNICODE" which gives on hanatrial.ondemand.com the exception 'sql syntax error: incorrect syntax near "UNICODE"'. Unfortunatly using '@Column(columnDefinition = "LONG BYTE")' also gives an exception on hanatrial.ondemand.com : Internal Exception: com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "LONG". That is with the automatic default of org.eclipse.persistence.platform.database.DatabasePlatform.

 

So what is the recommended way that it works locally and in the SAP HANA Cloud?

 

Regards,

  Wolfgang


Viewing all articles
Browse latest Browse all 1318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>