Hi Rafael,

Its somewhat off the topic of GWT but the inheritance you wish to map
is not a problem with Hibernate annotations.

Using an example the class HumanResource below inherits from the
Resource class:

@Entity
@Table(name = "resource")
@Inheritance(strategy = InheritanceType.JOINED)
public class ResourcePOJO implements Serializable
{
    //// Your annotated getters and setters
}

@Entity
@Table(name="human_resource")
@Inheritance(strategy = InheritanceType.JOINED)
@PrimaryKeyJoinColumn(name="resource_id")
public class HumanResourcePOJO extends ResourcePOJO implements
Serializable
{
    //// Your annotated getters and setters
}

Notice the inheritance annotation and the PrimaryKeyJoinColumn
annotation.

Eggsy

On May 27, 4:09 pm, Rafael Barrera Oro <boraf...@gmail.com> wrote:
> Sorry for taking so long in replying and thank you for your answers. I am
> trying to map the following relationship.
>
> I have a contact table which holds common data such as name, last name,
> observations, etc and i have a employee table which inherits all the fields
> from the contact table and adds the employeenumber field. So, it will be a
> simple case of inheritance with a table per sublass mapping
>
> Thanks in advance!
>
> Rafael
>
> 2009/5/21 eggsy <jimbob...@hotmail.com>
>
>
>
> > Hi Rafel,
>
> > Yeah you can do everything in Hibernate Annotations its really quite
> > powerful. We have moved to using it fully now instead of mapping
> > files.
>
> > Using the mapping file to simply hold our queries.
>
> > What kind of relationship are you trying to map?
>
> > Eggsy
>
> > PS. Paul - yeah that framework does seem to be plugged quite a
> > lot..... ;)
>
> > On May 21, 7:22 am, George Georgovassilis <g.georgovassi...@gmail.com>
> > wrote:
> > > And Jim, no, we don't find Hibernate hard to use, especially since
> > > it's a quasi-standard;-)
>
> > > On May 20, 7:56 pm, Jim <jim.p...@gmail.com> wrote:
>
> > > > Rafael,
>
> > > > If you find Hibernate is difficult to use, you may try Dreamsource ORM
> > > > for your application. You can find an GWT example inhttp://
> >www.gwtorm.com/mail/Mail.html.
>
> > > > Jimhttp://www.gwtorm.comforGWTORMhttp://
> > code.google.com/p/dreamsource-orm/
>
> > > > On May 20, 12:52 pm, Rafael <boraf...@gmail.com> wrote:
>
> > > > > Hello everyone!
>
> > > > >    I have the following problem and was hoping you guys could help me
> > > > > out. I have the need to implement a relation inheritance (table per
> > > > > subclass) so i searched the hibernate documentation.
> > > > >    The thing is that i am using a project structure which i took from
> > > > > a tutorial i found, and i have the following configuration files:
>
> > > > > applicationContext.xml (Spring stuff i suppose)
>
> > > > > hibernate.cfg.xml (mappings)
> > > > > database.hbm.xml (hibernate query definitions)
>
> > > > > My question is where should the code to define complex relations
> > > > > should go, hibernate.cfg.xml or database.hbm.xml?
>
> > > > > Is it possible to take care of everything with annotations
> > > > > (eliminating the need to change xml files)?
>
> > > > > Thanks in advance y'all!
>
> > > > > PD: Thank you Eggsy for your tutorial on GWT, Hibernate ans Spring
> > > > > combined! very enlightning :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to