[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - JBossRollbackException

jactor do-not-reply at jboss.com
Tue Nov 7 07:31:41 EST 2006


A strange situation!

I have persisted an entity bean, but when I try to read (READ) the entity back with a query object given by the entity manager, a rollback exception is thrown...

...my questions: why? and what can I do to avoid this?

The exception:

  | org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=C6ZHZ0J/11, BranchQual=, localId=11] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: nu.hjemme.user.persistence.MenuItem.name)

I have a entity called User which has the following relation:

  |     @IndexColumn(name = "menuItemsIndex")
  |     @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
  |     @JoinColumn(name = "userId")
  |     private List <MenuItem> menuItems = null;
  | 

The property of the MenuItem which is not supposed to be null:

  |     @Column(length = 15, nullable = false)
  |     private String name = null;
  | 

... again: why is this happening? It seems like it is trying to committ something when I only want to read from the database. 

I try to read the database with an ejb query (EJBQL) but this exception is thrown before the query is compiled by hibernate.

I am using jboss-4.0.5.GA.

The exception is mentioning that it is not part of a transaction (status=STATUS_NO_TRANSACTION), but I would not think that this was necessary when reading. Another question regarding entity managers: It is stated that a entity manager has a transaction scope of the instantiating class. If you instantiate the entity manager in one class but use this instance with a sub class by invoking a method on the super class, will this affect the transaction scope?

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

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



More information about the jboss-user mailing list