-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate tools - Change the name of many-to-many relations
PostPosted: Sat Mar 26, 2011 8:40 pm 
Beginner
Beginner

Joined: Tue Oct 30, 2007 7:57 am
Posts: 47
I am reversing engeneering a MySQL database, to create JPA POJOS from tables. I use the Eclipse Plugin for hibernate tools

There are to main tables, "person" and "place", and a pure relation table "person_place". Reverse engeneering creates the following POJOs

Code:

public class Person implements java.io.Serializable {
   private Long id;
   private String name;
   private Set<Place> places = new HashSet<Place>(0);
   
   .... getters-setters

   @ManyToMany(fetch = FetchType.LAZY)
   @JoinTable(name = "persona_puesto", catalog = "test", joinColumns = { @JoinColumn(name = "ID_PERSONA", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "ID_PUESTO", nullable = false, updatable = false) })
   public Set<Place> getPlaces() {
      return this.places;
   }

   public void setPlaces(Set<Place> places) {
      this.places = places;
   }

}

public class Place implements java.io.Serializable {

   private Long id;
   private String dePlace;
   private Set<Person> persons = new HashSet<Person>(0);

   .... getters-setters

   @ManyToMany(fetch = FetchType.LAZY, mappedBy = "places")
   public Set<Person> getPersons() {
      return this.persons;
   }

   public void setPersons(Set<Person> persons) {
      this.persons = persons;
   }

}



The many-to-many relation is mapped correctly, but I need to change the name of the many to many relations and I can't find a way. I found easy to change names with hibernate.reveng.xml in @ManyToOne or @OneToMany but it seems impossible in @ManyToMany. Is it possible to do that?


Top
 Profile  
 
 Post subject: Re: Hibernate tools - Change the name of many-to-many relations
PostPosted: Sat Mar 26, 2011 9:38 pm 
Beginner
Beginner

Joined: Tue Oct 30, 2007 7:57 am
Posts: 47
I forgot. My environment is:

Eclipse Helios 3.6.1
JBossTools 3.2
MySql Server 5.5


Top
 Profile  
 
 Post subject: Re: Hibernate tools - Change the name of many-to-many relations
PostPosted: Tue Apr 12, 2011 9:37 am 
Senior
Senior

Joined: Tue Aug 04, 2009 7:45 am
Posts: 124
Rober2D2,
sorry don't understand what would you like to rename/map differently there?


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