-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: unable to insert the record in the DataBase
PostPosted: Thu May 22, 2014 2:51 am 
Newbie

Joined: Thu May 22, 2014 2:26 am
Posts: 3
Code:

@Entity
@Table(name = "table1", uniqueConstraints = @UniqueConstraint(columnNames = "table1ID"))
public class Table1  implements java.io.Serializable {

   /**
    * Serial Id of the class.
    */
   private static final long serialVersionUID = 4098136300929982619L;

   @Id
   @GeneratedValue(strategy = IDENTITY)
   @Column(name = "table1ID", unique = true, nullable = false)
   private Long table1ID =  DatabaseConstants.INVALID_VALUE;
      
   @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "table2")
   private Set<Table2> table2 = new HashSet<table2>(0);
   
}

@Entity
@Table(name = "table2", uniqueConstraints = @UniqueConstraint(columnNames = "table2ID"))
public class Table2   implements java.io.Serializable {
   
   /**
    * Serial Id of the class.
    */
   private static final long serialVersionUID = 5395459647729458145L;

   @Id
   @GeneratedValue(strategy = IDENTITY)
   @Column(name = "table2ID", unique = true, nullable = false)
   private Long table2ID =  DatabaseConstants.INVALID_VALUE;

   @ManyToOne(fetch = FetchType.LAZY)
   @JoinColumn(name = "table1ID", nullable = false)
   private Table1 table1;
   
   @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "table3")
   private Set<Table3> table3 = new HashSet<table3>(0);
}

@Entity
@Table(name = "table3", uniqueConstraints = @UniqueConstraint(columnNames = "table3ID"))
public class Table3   implements java.io.Serializable {
   
   /**
    * Serial Id of the class.
    */
   private static final long serialVersionUID = 5395459647729458145L;

   @Id
   @GeneratedValue(strategy = IDENTITY)
   @Column(name = "table3ID", unique = true, nullable = false)
   private Long table3ID =  DatabaseConstants.INVALID_VALUE;

   @ManyToOne(fetch = FetchType.LAZY)
   @JoinColumn(name = "table2ID", nullable = false)
   private Table2 table2;
}



insertTable2(Table2 table2){
         this.userTxn.begin();
         this.entityManager.persist(table2);
         this.entityManager.flush();
         this.userTxn.commit();
}


getting below error when i try to insert a record in table2

javax.ejb.EJBException: Application error: BMT stateless bean OperationDaoBean should complete transactions before returning (ejb1.1 spec, 11.6.1)
at org.jboss.ejb3.tx.StatelessBMTInterceptor.checkStatelessDone(StatelessBMTInterceptor.java:86)
at org.jboss.ejb3.tx.StatelessBMTInterceptor.handleInvocation(StatelessBMTInterceptor.java:112)
at org.jboss.ejb3.tx.BMTInterceptor.invoke(BMTInterceptor.java:57)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)


i did not get any error while insert data in table1, getting above error while inserting in table2 only

getting same error with and without @TransactionAttribute(TransactionAttributeType.REQUIRED)

please help me on this


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.