openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C N Davies" <...@cndavies.com>
Subject Very weird enhancement error - is the class enhanced or not? - OpenJPA seems confused
Date Mon, 27 Jul 2009 20:40:28 GMT
I am getting a very strange error when calling persist/merge on my entity
under only one specific case.

 

Basically I have a User entity and a UserProfile Entity. The User entity has
a one to one mapping to the UserProfile entity. This is all working fine.

 

I have a Country entity, a Locale entity and Currency entity, all of which I
can create,persist,merge with no issues. 

 

 

The problem occurs when I add a many to one relationship to my UserProfile
entity for a Country entity.  When I persist/merge a User entity, it
cascades to it’s related UserProfile which in turn cascades to its Country
entity. So here is the relationship:

 

User -à UserProfile à Country

 

When I call persist/merge on the User entity I get this error:

 

<openjpa-1.2.0-r422266:683325 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: No metadata was found for
type "class java.lang.Class". The class is not enhanced.

 

That doesn’t make any sense because there is no generic class in the
entities being saved.

 

To confuse the issue, when I have an empty UserProfile table, I get the same
error but the UserProfile does get saved. Later when I try to make a change
to the UserProfile on the User and call merge, then I get the same error but
the UserProfile is not updated.

 

To confuse things even more, if I add the other two additional entities to
UserProfile (currency and locale) then they work just fine. The other two
entities are actually the same class as the Country class just renamed.

 

All these classes are defined in my persistence.xml and I can do anything to
them (persist/merge) if I use them by themselves, but only under the
scenario described above will I get this issue.

 

Does anyone have a clue what might be the issue? I put on trace logging but
can’t see any insert/update query being executed due to this metadata issue.
Here is the full stacktrace:

 

<openjpa-1.2.0-r422266:683325 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: No metadata was found for
type "class java.lang.Class". The class is not enhanced.

      at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.ja
va:298)

      at
org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1114)

      at
org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java
:268)

      at
org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java
:451)

      at com.trm.jpa.services.EntityService.find(EntityService.java:80)

      at
com.trm.beans.backing.UserListBackingBean.countryValueChanged(UserListBackin
gBean.java:215)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)

      at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)

      at java.lang.reflect.Method.invoke(Method.java:597)

      at org.apache.el.parser.AstValue.invoke(AstValue.java:131)

      at
org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)

      at
org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)

      at
javax.faces.event.MethodExpressionValueChangeListener.processValueChange(Met
hodExpressionValueChangeListener.java:80)

      ... 31 more

114986  trmPU  TRACE  [http-8080-1] openjpa.jdbc.JDBC - The batch limit is
set to 0.

114995  trmPU  TRACE  [http-8080-1] openjpa.jdbc.SQL - <t 7444146, conn
19525584> executing prepstmnt 31115924 UPDATE User SET active = ?,
createdate = ?, updatedate = ?, name = ?, PROFILE_ID = ? WHERE uniqueid = ?
[params=(int) 1, (Timestamp) 2009-07-27 02:13:53.0, (Timestamp) 2009-07-28
06:19:59.464, (String)  Christopher Davies, (String) 3051, (String)
cndavies]

114996  trmPU  TRACE  [http-8080-1] openjpa.jdbc.SQL - <t 7444146, conn
19525584> [1 ms] spent

114996  trmPU  TRACE  [http-8080-1] openjpa.jdbc.SQL - <t 7444146, conn
19525584> executing prepstmnt 4155459 UPDATE UserProfile SET email = ?, fax
= ?, mobile = ?, phone = ?, COUNTRY_UNIQUEID = ?, CURRENCY_UNIQUEID = ?,
LOCALE_UNIQUEID = ? WHERE id = ? [params=(String) cnd@cndavies.com, (String)
02 9356 4557, (String) 0403655872, (String) 02 9356 4557, (String) AL,
(String) JPY, (String) en_NZ, (String) 3051]

114999  trmPU  TRACE  [http-8080-1] openjpa.jdbc.SQL - <t 7444146, conn
19525584> [3 ms] spent

115000  trmPU  TRACE  [http-8080-1] openjpa.jdbc.SQL - <t 7444146, conn
19525584> executing prepstmnt 27931988 UPDATE User SET active = ?,
createdate = ?, updatedate = ?, name = ?, PROFILE_ID = ? WHERE uniqueid = ?
[params=(int) 1, (Timestamp) 2009-07-27 02:13:53.0, (Timestamp) 2009-07-28
06:19:59.464, (String)  Wandy Rarung, (null) null, (String) wrrarung]

115000  trmPU  TRACE  [http-8080-1] openjpa.jdbc.SQL - <t 7444146, conn
19525584> [0 ms] spent

115000  trmPU  TRACE  [http-8080-1] openjpa.jdbc.SQL - <t 7444146, conn
19525584> executing prepstmnt 26426732 UPDATE Locale SET active = ?,
createdate = ?, updatedate = ?, description = ? WHERE uniqueid = ?
[params=(int) 1, (Timestamp) 2009-07-28 05:19:34.0, (Timestamp) 2009-07-28
06:19:59.463, (String) English (New Zealand), (String) en_NZ]

115002  trmPU  TRACE  [http-8080-1] openjpa.jdbc.SQL - <t 7444146, conn
19525584> [2 ms] spent

115002  trmPU  TRACE  [http-8080-1] openjpa.jdbc.SQL - <t 7444146, conn
19525584> executing prepstmnt 18417789 UPDATE Currency SET active = ?,
createdate = ?, updatedate = ?, country = ?, name = ? WHERE uniqueid = ?
[params=(int) 1, (Timestamp) 2009-07-21 19:09:13.0, (Timestamp) 2009-07-28
06:19:59.463, (null) null, (String) Australian Dollar, (String) JPY]

115003  trmPU  TRACE  [http-8080-1] openjpa.jdbc.SQL - <t 7444146, conn
19525584> [1 ms] spent

115003  trmPU  TRACE  [http-8080-1] openjpa.jdbc.SQL - <t 7444146, conn
19525584> executing prepstmnt 8159373 UPDATE Country SET active = ?,
createdate = ?, updatedate = ?, name = ? WHERE uniqueid = ? [params=(int) 1,
(Timestamp) 2009-07-28 05:15:09.0, (Timestamp) 2009-07-28 06:19:59.464,
(String) AUSTRALIA, (String) AL]

115004  trmPU  TRACE  [http-8080-1] openjpa.jdbc.SQL - <t 7444146, conn
19525584> [1 ms] spent

115029  trmPU  TRACE  [http-8080-1] openjpa.jdbc.JDBC - <t 7444146, conn
19525584> [25 ms] commit

115030  trmPU  TRACE  [http-8080-1] openjpa.jdbc.JDBC - <t 7444146, conn
19525584> [1 ms] close

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message