OpenJPA debugging

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

OpenJPA debugging

Matthew Broadhead-2
i am using TomEE 7.0.5 with OpenJPA 2.4.2.  i am defining multiple
persistence units in persistence.xml

i am getting an error about casting which doesn't help me track it down
openjpa-2.4.3-r422266:1833086 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: java.lang.Integer
cannot be cast to java.lang.Long
FailedObject: uk.me.kissy.database.entities.jpa.file.File-727648
[java.lang.String]
     at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3521)
...
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be
cast to java.lang.Long
     at
org.apache.openjpa.meta.JavaTypes.isPrimitiveDefault(JavaTypes.java:503)
     at
org.apache.openjpa.kernel.VersionAttachStrategy.compareVersion(VersionAttachStrategy.java:185)

if i try to add the following to my persistence unit i can't start the
container
<property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=DEBUG,
Tool=DEBUG, SQL=TRACE" />

it fails with this kind of thing
09-Dec-2018 19:22:07.261 SEVERE [localhost-startStop-1]
org.apache.openejb.assembler.classic.Assembler.destroyApplication
undeployException original cause
  java.lang.Exception: persistence-unit: sales 145860742localhost: Name
"openejb/PersistenceUnit/sales 145860742localhost" not found.
     at
org.apache.openejb.assembler.classic.Assembler.destroyApplication(Assembler.java:2490)
     at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:1092)
     at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:757)

there may root cause above this but i would have to write log to file
rather than console and wondered first if you had any ideas

Reply | Threaded
Open this post in threaded view
|

Re: OpenJPA debugging

Matthew Broadhead-2
don't worry.  it turned out that I had set
@Version
private long version

changing it to
@Version
private Long version

fixed the problem.

On 09/12/2018 19:27, Matthew Broadhead wrote:

> i am using TomEE 7.0.5 with OpenJPA 2.4.2.  i am defining multiple
> persistence units in persistence.xml
>
> i am getting an error about casting which doesn't help me track it down
> openjpa-2.4.3-r422266:1833086 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: java.lang.Integer
> cannot be cast to java.lang.Long
> FailedObject: uk.me.kissy.database.entities.jpa.file.File-727648
> [java.lang.String]
>     at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3521)
> ...
> Caused by: java.lang.ClassCastException: java.lang.Integer cannot be
> cast to java.lang.Long
>     at
> org.apache.openjpa.meta.JavaTypes.isPrimitiveDefault(JavaTypes.java:503)
>     at
> org.apache.openjpa.kernel.VersionAttachStrategy.compareVersion(VersionAttachStrategy.java:185)
>
> if i try to add the following to my persistence unit i can't start the
> container
> <property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=DEBUG,
> Tool=DEBUG, SQL=TRACE" />
>
> it fails with this kind of thing
> 09-Dec-2018 19:22:07.261 SEVERE [localhost-startStop-1]
> org.apache.openejb.assembler.classic.Assembler.destroyApplication
> undeployException original cause
>  java.lang.Exception: persistence-unit: sales 145860742localhost: Name
> "openejb/PersistenceUnit/sales 145860742localhost" not found.
>     at
> org.apache.openejb.assembler.classic.Assembler.destroyApplication(Assembler.java:2490)
>     at
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:1092)
>     at
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:757)
>
> there may root cause above this but i would have to write log to file
> rather than console and wondered first if you had any ideas
>