[jboss-user] [EJB 3.0] - Re: Enum attributes in Entity Beans ...

wcydaip do-not-reply at jboss.com
Thu Jul 27 17:50:49 EDT 2006


"dsouza" wrote : Ok, I tested it again for Oracle and it did work, however I did run into some other problems.
  | 
  | SOME SECURITY
  | 
  | I have a cactus test suite that inserts/updates/deletes entities in the database to make sure they're working and that they have the appropriate permissions. So in order to test the use of enums in an entity I used one of my entity tests (for an entity that needs an enum).
  | 
  | Basically I have this line of code in my test suite:
  | 
  |   | interfaceMessage.setMessageType(InterfaceMessageType.WARNING);
  |   | 
  | where InterfaceMessageType is my enum. If I change the line to
  | 
  |   | interfaceMessage.setMessageType(InterfaceMessageType.ERROR);
  |   | 
  | and redeploy without restarting JBOSS, I get the following exception:
  | 
  | 
  |   | org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of entity.iface.InterfaceMessage.setMessageType
  |   | 	at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValuesWithOptimizer(PojoEntityTuplizer.java:209)
  |   | 	at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:179)
  |   | 	at org.hibernate.persister.entity.BasicEntityPersister.setPropertyValues(BasicEntityPersister.java:2981)
  |   | ...
  |   | Caused by: net.sf.cglib.beans.BulkBeanException: entity.enums.InterfaceMessageType
  |   | 	at entity.iface.InterfaceMessage$$BulkBeanByCGLIB$$48beb320.setPropertyValues(<generated>)
  |   | 	at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValuesWithOptimizer(PojoEntityTuplizer.java:206)
  |   | 	... 84 more
  |   | Caused by: java.lang.ClassCastException: entity.enums.InterfaceMessageType
  |   | 	... 86 more
  |   | 
  | 
  | If I restart JBOSS everything works fine (until I change the code again). I really have no idea why this is happening but I thought maybe something from mixing the latest hibernate cvs with the ejb 3 beta release, but then again I guess it's unlikely since hibernate handles the persistence. Any ideas of what might be causing this?
  | 
  | Another problem is that the latest cvs broke some of my other code. Maybe it's something that's really changed for good and I'm not up to date yet, but I'm getting the following exception:
  | 
  | 
  |   | org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=brain/24, BranchQual=, localId=24] status=STATUS_NO_TRANSACTION; - nested throwable: (java.lang.ClassCastException: java.util.ArrayList)
  |   | 
  |   | java.lang.RuntimeException: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=brain/24, BranchQual=, localId=24] status=STATUS_NO_TRANSACTION; - nested throwable: (java.lang.ClassCastException: java.util.ArrayList)
  |   | at org.jboss.aspects.tx.TxPolicy.handleEndTransactionException(TxPolicy.java:185)
  |   | at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:167)
  |   | at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:74)
  |   | ...
  |   | 
  | 
  | Looks like some problem in using ArrayList in OneToMany or ManyToMany relationships. Just thought you should know in case it's a new bug or something.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961438#3961438

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961438



More information about the jboss-user mailing list