-->
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: How would you use Hibernate Xdoclet tags to model this?
PostPosted: Sun Jun 05, 2005 9:48 am 
Beginner
Beginner

Joined: Sun Jun 05, 2005 9:45 am
Posts: 27
I have been learning to use appfuse recently and have really liked creating tables from hibernate xdoclet tags. I am stumped on this one though. The following tables map a normal many-many relationship using an association table. Below the table definitions is what I would like my classes to be like. How would I get xdoclet to generate these tables based on the class definitions below?



Regards,



Joshua















Code:
TEAM           TEAM_MODULE_ASSOC      MODULE     
----------     -----------------      ----------
id    (PK)     team_id      (PK)      id    (PK)
name           module_id    (PK)      name
               enabled 
               

public class Team {
 
  private Integer id;
  private Set modules = new HashSet();

  ...
   
  public getModules() {
    return this.modules;
  }
 
  public setModules(Set modules) {
    this.modules = modules;
  }

}             


public class Module {

  private Integer id;
  private String name;
  private boolean enabled;
 
  public isEnabled() {
     return this.enabled;
  }
 
  public setEnabled(boolean enabled) {
     this.enabled = enabled;
  }
 
 
}


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 05, 2005 6:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
First step is to understand how a standard mapping would work. Its a bit more complicated because you have extra field in the link table.
See FAQ: http://hibernate.org/118.html#A11
which shows the use of a composite element that contains the extra field and the Many-to-one.

Having a quick look at the XDoclet site, there is a @hibernate.collection-composite-element doc tag so you should have no problem mapping this using Xdoclet.


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.