-->
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.  [ 2 posts ] 
Author Message
 Post subject: Graph of Objects
PostPosted: Wed Mar 24, 2004 10:20 am 
Newbie

Joined: Mon Nov 10, 2003 7:39 pm
Posts: 8
It may seem tedious, but i have problem with graphs. i have simple one to many relationship. This is a part from the xml mapping:
Code:
   <class name="ObjectType" table="ObjectType">
      <id name="id" column="objecttype_id">
         <generator class="assigned"/>
      </id>

      <property name="name" column="name"/>

      <set name="attributes" inverse="true" lazy="true" order-by="name" cascade="save-update">
         <key column="objecttype_id"/>
         <one-to-many class="Attribute"/>
      </set>
   </class>

   <class name="Attribute" table="Attribute">
      <id name="id" column="attribute_id">
         <generator class="assigned"/>
      </id>

      <property name="name" column="name"/>

      <many-to-one class="ObjectType" name="objectType" column="objecttype_id"/>
   </class>

and i have the following code:

Code:
ObjectType objectType = manager.createObjectType(); // just new() operator
String otName = "ObjectTypeName";
objectType.setName(otName);

Collection attributes = objectType.getAttributes();

Attribute attribute = manager.createAttribute();
attribute.setName("A1");
attributes.add(attribute);

manager.store(objectType);


Manager just saves object this way:
Code:
Session session = sessionFactory.openSession();
session.save(object);
session.flush();
session.close();

and while saving i have 1 insert for object type and 1 _update_ for attribute! i dont know why.
what is wrong? if it's neccessary i can provide hibernate log.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 24, 2004 10:22 am 
Newbie

Joined: Mon Nov 10, 2003 7:39 pm
Posts: 8
and by the way, how can i rollback transaction under container management transaction in the session bean? it seems that ctx.setRollbackOnly() does work. App server - WL8.1


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