-->
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.  [ 6 posts ] 
Author Message
 Post subject: CMT and WEBSPHERE
PostPosted: Wed Feb 16, 2005 8:12 am 
Newbie

Joined: Wed Feb 16, 2005 7:55 am
Posts: 4
I am using CMT, so we should not explicitly begin and end transaction.
But i am.
Then why things work properly with JBOSS and Weblogic but not with
WebSphere?



Urgent!Urgent!Urgent!

Any kind of help will be appreciated!

kalpana


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 16, 2005 8:30 am 
Newbie

Joined: Mon Jan 31, 2005 11:33 am
Posts: 8
Location: Netherlands
Hi,
I got it working with relatively easy!!

Tip : <property name="net.sf.hibernate.transaction.JTATransactionFactory"> net.sf.hibernate.transaction.WebSphereTransactionManagerLookup</property>

Sample code

session = sessionFactory.openSession();
Transaction transaction =
try{
session.beginTransaction();
session.save(obj); // where ob is ur data
transaction.commit();
}
catch(HibernateException excp){transaction.roleback();}

Also have a look at this article:->

http://www-128.ibm.com/developerworks/w ... patil.html

Cheers
Anand


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 16, 2005 11:29 pm 
Newbie

Joined: Mon Feb 14, 2005 12:14 am
Posts: 14
Location: Boston, USA
When you are using CMT, you should not begin and commit the transactions. You container will take care of that. I was able to commit the data with session.flush() after the unit of work in WebSphere 5.0 application server.


Top
 Profile  
 
 Post subject: hibernate - cmt - session flushing
PostPosted: Sun Dec 04, 2005 3:09 pm 
Beginner
Beginner

Joined: Thu Dec 01, 2005 7:07 pm
Posts: 21
Is it required to do the session.flush explicitly in teh code OR is it possible to have it in the hibernate-cfg.xml file. hibernate.transaction.flush_before_completion prop to true and hibernate.transaction.auto_close_session to true. Anybody??


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 07, 2005 8:09 am 
Newbie

Joined: Wed Dec 07, 2005 8:00 am
Posts: 2
I have nearly the same problem with Websphere:
I want to store an unidireconal one-to-many relation between two entities.
The specific entry in the mapping looks like this:

<list name="relations" lazy="false" cascade="all" access="org.hibernate.property.DirectPropertyAccessor">
<key column="BUSINESSPARTNER_ID" not-null="true"/>
<list-index column="RELATION_SORT" />
<one-to-many class="BPAddressCommRelationImpl"/>
</list>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 07, 2005 8:17 am 
Newbie

Joined: Wed Dec 07, 2005 8:00 am
Posts: 2
completion to post above:

this code i posted above works fine. But if i change the not-null of the key-column to "false" the relation is not stored, that means the value in the index-column of the relation is null

I have tested the problem with a JUnit test case, therefor i changed from CMT to manual transaction handling. There i can change the not-null value to "false" but in that case i have to save both members of the relation in one transaction.

Now finally my question is:

What i have to do to get Webspere saving objects, that have a relation, in one transaction ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.