Thanks
For the help really appreciate that.
Wanted to ask one more thing is nested transaction possible in Hibernate.
That is can I write code something like this.
public void addCat()throws Exception{
Session session=null;
Transaction tx=null;
Cat cat=new Cat("Scarlet");
cat.addKitten(new Kitten("scarlet 01", cat));
cat.addKitten(new Kitten("scarlet 02", cat));
cat.addKitten(new Kitten("scarlet 03", cat));
cat.addKitten(new Kitten("scarlet 04", cat));
cat.addKitten(new Kitten("scarlet 05", cat));
try{
session=sessions.openSession();
tx=session.beginTransaction();
Transaction tx1=null;
Transaction tx2=null;
try{
tx1=session.beginTransaction();
session.save(cat);
tx1.commit();
}catch(Exception iex){
if(tx1!=null)tx1.rollback();
}
ListIterator lst=cat.getKitten().listIterator();
try{
tx2=session.beginTransaction();
while(lst.hasNext()){
session.save((Kitten)lst.next());
}
tx2.commit();
}catch(Exception iex){
if(tx2!=null) tx2.rollback();
}
tx.commit();
}catch(Exception ex){
System.out.println("Main transaction rollback");
try{
if (tx!=null) tx.rollback();
}catch(Exception iex){
throw iex;
}
}finally{
try{
if (session!=null) session.close();
}catch(Exception ex){
throw ex;
}
}
}
regards
prasad chandrasekaran
----- Original Message -----
From: "Christian Bauer" <[EMAIL PROTECTED]>
To: "Prasad Iyer" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, August 26, 2003 9:01 PM
Subject: Re: [Hibernate] Cascading inserts
> On 25 Aug (20:41), Prasad Iyer wrote:
>
> > Which option of the cascade I have to use to insert a parent with a
child.
> > I have tried "all" but gives me error.
>
> Read the "Parent/child" chapter in the reference documentation.
>
> Please stop asking beginner questions on the developer mailinglist. Read
> the documentation and after you followed the other instructions on the
> Wiki, you may ask on the forum. Thanks.
>
> --
> Christian Bauer
> [EMAIL PROTECTED]
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: VM Ware
> With VMware you can run multiple operating systems on a single machine.
> WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
> at the same time. Free trial click
here:http://www.vmware.com/wl/offer/358/0
> _______________________________________________
> hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel