You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Hiran Chaudhuri <hi...@amadeus.com> on 2010/03/01 15:46:29 UTC

JPA and streams

Hi there.

I'm trying to get OpenJPA running with Inputstreams. Somehow I always get 
Exceptions using OpenJPA 1.2.1, Oracle JDBC driver 10.2.0.4.0 and Oracle 
Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production.
The entity in question contains one field maked as:
    @Persistent
    InputStream data;

This is the exception obtained:

Exception in thread "main" <openjpa-1.2.1-r752877:753278 fatal store 
error> org.apache.openjpa.persistence.RollbackException: null
        at 
org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:523)
        at ...
Caused by: <openjpa-1.2.1-r752877:753278 nonfatal general error> 
org.apache.openjpa.persistence.PersistenceException: null
        at 
org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1834)
        at 
org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
        at 
org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1350)
        at 
org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:877)
        at 
org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:512)
        ... 1 more
Caused by: java.lang.NullPointerException
        at 
org.apache.openjpa.jdbc.sql.DBDictionary.updateBlob(DBDictionary.java:4304)
        at 
org.apache.openjpa.jdbc.meta.strats.LobFieldStrategy.customInsert(LobFieldStrategy.java:112)
        at 
org.apache.openjpa.jdbc.meta.FieldMapping.customInsert(FieldMapping.java:701)
        at 
org.apache.openjpa.jdbc.kernel.AbstractUpdateManager$CustomMapping.execute(AbstractUpdateManager.java:375)
        at 
org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:94)
        at 
org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:72)
        at 
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:717)
        at 
org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130)
        at 
org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2010)
        at 
org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1908)
        at 
org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1826)
        ... 5 more

Any ideas or workarounds?

Hiran


Hiran Chaudhuri
System Support Programmer / Analyst
IT Service Assurance
E-Commerce Service Assurance
Amadeus Data Processing GmbH
Berghamer Strasse 6
85435 Erding
T: +49-8122-43x3662
hiran.chaudhuri@amadeus.com
http://www.amadeus.com





RE: JPA and streams

Posted by Miłosz Tylenda <mt...@o2.pl>.
Hiran,

You are right. The LOB streaming is broken in 1.2. It works in 2.0 but there is still room for improvement, mainly for databases other than Oracle [1]. The supported databases and restrictions are briefly described in the 2.0 manual [2]. You might also try a 1.3.0 snapshot.

Mixing @LOB with @Persistent is not a good mariage.

Regards,
Milosz

[1] http://issues.apache.org/jira/browse/OPENJPA-1248
[2] http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_streamsupport


> 
> > 
> Meanwhile I tried OpenJPA 2.0.0 beta - and the very same code
> executes just fine.
> I cannot tell what made the difference, but then there are quite
> some modifications between the releases...
> 
> Hiran
> 
> PS: I have been told that @LOB should not be used in conjunction
> with @Persistent. However when I combined the two with OpenJPA
> 1.2.1 it did not work either.
> 
> 
> Hiran Chaudhuri
> System Support Programmer / Analyst
> IT Service Assurance
> E-Commerce Service Assurance
> Amadeus Data Processing GmbH
> Berghamer Strasse 6
> 85435 Erding
> T: +49-8122-43x3662
> hiran.chaudhuri@amadeus.com
> http://www.amadeus.com
> 
> 
> 
> "Andrew Thompson" <at...@openjpa.apache.org>
cc
bcc
SubjectRE: JPA and streams

> 

> "Andrew Thompson" <at...@columbia.edu>Please respond to : users@openjpa.apache.org
> 01-03-10 15:58
> 

> 
> 
> Did you try @Lob?
> 
> http://openjpa.apache.org/builds/latest/docs/manual/ref_guide_mapping_jpa.html
> http://www.ibmpressbooks.com/articles/article.asp?p=1192350&seqNum=4
> 
> I struggled with this also about a year ago when I was trying to
> refactor some legacy code and eventually gave up due to an imminent
> deadline - so I'm curious to hear how you solve this also.
> 
> -Andy
> 
> 
> -----Original Message-----
> From: Hiran Chaudhuri [mailto:hiran.chaudhuri@amadeus.com]
> Sent: Mon 3/1/2010 9:46 AM
> To: users@openjpa.apache.org
> Subject: JPA and streams
> 
> 
> Hi there.
> 
> I'm trying to get OpenJPA running with Inputstreams. Somehow I
> always get Exceptions using OpenJPA 1.2.1, Oracle JDBC driver
> 10.2.0.4.0 and Oracle Database 10g Enterprise Edition Release
> 10.2.0.4.0 - 64bit Production.
> The entity in question contains one field maked as:
>    @Persistent
>    InputStream data;
> 
> This is the exception obtained:
> 
> Exception in thread "main"
> <openjpa-1.2.1-r752877:753278 fatal store error>
> org.apache.openjpa.persistence.RollbackException: null
>        at
> org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:523)
>        at ...
> Caused by: <openjpa-1.2.1-r752877:753278 nonfatal general
> error> org.apache.openjpa.persistence.PersistenceException: null
>        at
> org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1834)
>        at
> org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
>        at
> org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1350)
>        at
> org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:877)
>        at
> org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:512)
>        ... 1 more
> Caused by: java.lang.NullPointerException
>        at
> org.apache.openjpa.jdbc.sql.DBDictionary.updateBlob(DBDictionary.java:4304)
>        at
> org.apache.openjpa.jdbc.meta.strats.LobFieldStrategy.customInsert(LobFieldStrategy.java:112)
>        at
> org.apache.openjpa.jdbc.meta.FieldMapping.customInsert(FieldMapping.java:701)
>        at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager$CustomMapping.execute(AbstractUpdateManager.java:375)
>        at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:94)
>        at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:72)
>        at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:717)
>        at
> org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130)
>        at
> org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2010)
>        at
> org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1908)
>        at
> org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1826)
>        ... 5 more
> 
> Any ideas or workarounds?
> 
> Hiran
> 
> 
> Hiran Chaudhuri
> System Support Programmer / Analyst
> IT Service Assurance
> E-Commerce Service Assurance
> Amadeus Data Processing GmbH
> Berghamer Strasse 6
> 85435 Erding
> T: +49-8122-43x3662
> hiran.chaudhuri@amadeus.com
> http://www.amadeus.com <http://www.amadeus.com/>  
> 
> Amadeus logo <http://www.amadeus.com/>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 



RE: JPA and streams

Posted by Hiran Chaudhuri <hi...@amadeus.com>.
Meanwhile I tried OpenJPA 2.0.0 beta - and the very same code executes 
just fine.
I cannot tell what made the difference, but then there are quite some 
modifications between the releases...

Hiran

PS: I have been told that @LOB should not be used in conjunction with 
@Persistent. However when I combined the two with OpenJPA 1.2.1 it did not 
work either.


Hiran Chaudhuri
System Support Programmer / Analyst
IT Service Assurance
E-Commerce Service Assurance
Amadeus Data Processing GmbH
Berghamer Strasse 6
85435 Erding
T: +49-8122-43x3662
hiran.chaudhuri@amadeus.com
http://www.amadeus.com




"Andrew Thompson" <at...@columbia.edu> 
To
<us...@openjpa.apache.org>
cc

bcc

Subject
RE: JPA and streams





"Andrew Thompson" <at...@columbia.edu>
Please respond to : users@openjpa.apache.org
01-03-10 15:58


Did you try @Lob?

http://openjpa.apache.org/builds/latest/docs/manual/ref_guide_mapping_jpa.html

http://www.ibmpressbooks.com/articles/article.asp?p=1192350&seqNum=4

I struggled with this also about a year ago when I was trying to refactor 
some legacy code and eventually gave up due to an imminent deadline - so 
I'm curious to hear how you solve this also.

-Andy


-----Original Message-----
From: Hiran Chaudhuri [mailto:hiran.chaudhuri@amadeus.com]
Sent: Mon 3/1/2010 9:46 AM
To: users@openjpa.apache.org
Subject: JPA and streams
 

Hi there. 

I'm trying to get OpenJPA running with Inputstreams. Somehow I always get 
Exceptions using OpenJPA 1.2.1, Oracle JDBC driver 10.2.0.4.0 and Oracle 
Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production. 
The entity in question contains one field maked as: 
    @Persistent 
    InputStream data; 

This is the exception obtained: 

Exception in thread "main" <openjpa-1.2.1-r752877:753278 fatal store 
error> org.apache.openjpa.persistence.RollbackException: null 
        at 
org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:523) 

        at ... 
Caused by: <openjpa-1.2.1-r752877:753278 nonfatal general error> 
org.apache.openjpa.persistence.PersistenceException: null 
        at 
org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1834) 

        at 
org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81) 

        at 
org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1350) 
        at 
org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:877) 

        at 
org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:512) 

        ... 1 more 
Caused by: java.lang.NullPointerException 
        at 
org.apache.openjpa.jdbc.sql.DBDictionary.updateBlob(DBDictionary.java:4304) 

        at 
org.apache.openjpa.jdbc.meta.strats.LobFieldStrategy.customInsert(LobFieldStrategy.java:112) 

        at 
org.apache.openjpa.jdbc.meta.FieldMapping.customInsert(FieldMapping.java:701) 

        at 
org.apache.openjpa.jdbc.kernel.AbstractUpdateManager$CustomMapping.execute(AbstractUpdateManager.java:375) 

        at 
org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:94) 

        at 
org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:72) 

        at 
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:717) 

        at 
org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130) 

        at 
org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2010) 
        at 
org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1908) 
        at 
org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1826) 

        ... 5 more 

Any ideas or workarounds? 

Hiran 


Hiran Chaudhuri
System Support Programmer / Analyst
IT Service Assurance
E-Commerce Service Assurance
Amadeus Data Processing GmbH
Berghamer Strasse 6
85435 Erding
T: +49-8122-43x3662
hiran.chaudhuri@amadeus.com
http://www.amadeus.com <http://www.amadeus.com/> 

Amadeus logo <http://www.amadeus.com/> 












RE: JPA and streams

Posted by Andrew Thompson <at...@columbia.edu>.
Did you try @Lob?

http://openjpa.apache.org/builds/latest/docs/manual/ref_guide_mapping_jpa.html
http://www.ibmpressbooks.com/articles/article.asp?p=1192350&seqNum=4

I struggled with this also about a year ago when I was trying to refactor some legacy code and eventually gave up due to an imminent deadline - so I'm curious to hear how you solve this also.

-Andy


-----Original Message-----
From: Hiran Chaudhuri [mailto:hiran.chaudhuri@amadeus.com]
Sent: Mon 3/1/2010 9:46 AM
To: users@openjpa.apache.org
Subject: JPA and streams
 

Hi there. 

I'm trying to get OpenJPA running with Inputstreams. Somehow I always get Exceptions using OpenJPA 1.2.1, Oracle JDBC driver 10.2.0.4.0 and Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production. 
The entity in question contains one field maked as: 
    @Persistent 
    InputStream data; 

This is the exception obtained: 

Exception in thread "main" <openjpa-1.2.1-r752877:753278 fatal store error> org.apache.openjpa.persistence.RollbackException: null 
        at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:523) 
        at ... 
Caused by: <openjpa-1.2.1-r752877:753278 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: null 
        at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1834) 
        at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81) 
        at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1350) 
        at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:877) 
        at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:512) 
        ... 1 more 
Caused by: java.lang.NullPointerException 
        at org.apache.openjpa.jdbc.sql.DBDictionary.updateBlob(DBDictionary.java:4304) 
        at org.apache.openjpa.jdbc.meta.strats.LobFieldStrategy.customInsert(LobFieldStrategy.java:112) 
        at org.apache.openjpa.jdbc.meta.FieldMapping.customInsert(FieldMapping.java:701) 
        at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager$CustomMapping.execute(AbstractUpdateManager.java:375) 
        at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:94) 
        at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:72) 
        at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:717) 
        at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130) 
        at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2010) 
        at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1908) 
        at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1826) 
        ... 5 more 

Any ideas or workarounds? 

Hiran 


Hiran Chaudhuri
System Support Programmer / Analyst
IT Service Assurance
E-Commerce Service Assurance
Amadeus Data Processing GmbH
Berghamer Strasse 6
85435 Erding
T: +49-8122-43x3662
hiran.chaudhuri@amadeus.com
http://www.amadeus.com <http://www.amadeus.com/>  

Amadeus logo <http://www.amadeus.com/>