-->
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.  [ 4 posts ] 
Author Message
 Post subject: Artifact generation list xml files for subclasses
PostPosted: Fri Sep 23, 2005 2:57 pm 
Regular
Regular

Joined: Mon Jun 14, 2004 1:42 pm
Posts: 80
Location: Brazil
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
alpha tools 6 (jboss ide bundle)
Mapping documents:
GuestType.hbm.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping package="pethotel">
   <class
      name="GuestType"
      table="GuestType"
   >   


      <id
         column="guestTypeId"
         name="guestTypeId"
         type="java.lang.Integer"
      >
         <generator class="increment">
         </generator>
      </id>   
      <property
         name="name"
         column="name"

         type="string"
         not-null="true"
        >
      </property>



      <set
         inverse="true"
         lazy="true"
         name="RoomTypeGuestSet"
         
      >
         <key column="guestTypeId" />
         <one-to-many class="pethotel.RoomTypeGuest" />
      </set>   

      <set
         inverse="true"
         lazy="true"
         name="ServiceGuestSet"
         
      >
         <key column="guestTypeId" />
         <one-to-many class="pethotel.ServiceGuest" />
      </set>   
   <joined-subclass
      name="Category"
      table="Category"
   >   
    <key column="categoryId"/>   



      <many-to-one
         name="parent"
         class="pethotel.Category"
         not-null="true"

      >
         <column name="parent"/>
      </many-to-one>

      <set
         inverse="true"
         lazy="true"
         name="childs"
      >
         <key column="parent" />
         <one-to-many class="pethotel.Category" />
      </set>   

      <set
         inverse="true"
         lazy="true"
         name="SpeciesSet"
      >
         <key column="categoryId" />
         <one-to-many class="pethotel.Species" />
      </set>   

</joined-subclass>
   <joined-subclass
      name="Species"
      table="Species"
   >   
    <key column="speciesId"/>   



      <many-to-one
         name="categoryId"
         class="pethotel.Category"
         not-null="true"

      >
         <column name="categoryId"/>
      </many-to-one>

      <set
         inverse="true"
         lazy="true"
         name="PetSet"
      >
         <key column="speciesId" />
         <one-to-many class="pethotel.Pet" />
      </set>   

</joined-subclass>

   </class>
</hibernate-mapping>



generated hibernate.cfg.xml
Code:
        <mapping resource="pethotel/GuestType.hbm.xml" />
        <mapping resource="pethotel/Category.hbm.xml" />
        <mapping resource="pethotel/Species.hbm.xml" />


As you can see the artifact generator is generating the subclasses as separated files. Every time I have to remove them by hand. What I'm doing wrong ?

Thx
and.... aplha 6 version is much better!
[/code]

_________________
Alexandre Torres
--------------------


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 23, 2005 3:36 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
did the tool generate that hbm.xml ?

the hibernate.cfg.xml assumes that you have one file per class (more modular) - we could probably have an option saying "one file per class hiearchy" but it gets muddy i think.


thanks for the "much better" ;) like to comment what is so much better in alpha6 ? ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 23, 2005 3:49 pm 
Regular
Regular

Joined: Mon Jun 14, 2004 1:42 pm
Posts: 80
Location: Brazil
Graphic view of components is promising, database explorer, hql autocomplete, option to create the console with configuration. The configuration is explicit (in older versions It was hard to understand what/where it was).
I think that it would be a little better if when I select and Object X, it can show the object's properties, but I know that it will be implemented someday.

I have never tried to use seprareted files to subclasses. Does it work fine and with all cases of inheritance ? :-)
I think I will start to use that way. I agree with you, it's more modular.

_________________
Alexandre Torres
--------------------


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 24, 2005 6:13 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Hi,

Selecting an object and viewing its properties have always been there.
Open up the Properties view and see.

And yes, separation of files works across all types of inheritance.

/max

_________________
Max
Don't forget to rate


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