-->
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.  [ 3 posts ] 
Author Message
 Post subject: JBoss Hibernate transaction problem
PostPosted: Wed May 28, 2008 5:22 am 
Newbie

Joined: Thu Jan 10, 2008 6:52 am
Posts: 6
Hi,

I turned on Hibernate 3.1 on JBoss 4.0.5 using JMX manner, as mbean.

It works fine, I can notice it on JMX-Console.

Then I was going to use that database schema in EJB. I made simple session stateless bean, which serves some business method for data saving trough the Hibernate layer. The method signatured as transaction Required, so please have look on piece of source:

Code:
   /**
    * An example business method
    *
    * @ejb.interface-method view-type = "remote"
    * @ejb.transaction type = "Required"
    *
    * @throws EJBException Thrown if method fails due to system-level error.
    */
   public void save(Message message) throws EJBException {
      // rename and start putting your business logic here
      Session se = hCx.getSession(SF_JNDI);
      se.saveOrUpdate(message);
   }


where hCx is actually HibernateContext as follow:

Code:
   /** The session context */
   private SessionContext cx;
   private HibernateContext hCx;


Unfortunately, It doesn't work, the changes are not saved.

What's wrong?

Thanks for help
Krzysztof


Top
 Profile  
 
 Post subject: Re: JBoss Hibernate transaction problem
PostPosted: Wed May 28, 2008 1:15 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
Do you see any sql output?



Farzad-


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 29, 2008 9:45 am 
Newbie

Joined: Thu Jan 10, 2008 6:52 am
Posts: 6
I verified carefully step by step the problem.

The thing was, that in the descriptor (<bean>.hbm.xml) in tag <id> I was have some attribiutes, which confused resolving usaved value state

In case, saveOrUpdate method processed the update only.


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

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.