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: Generated Code questions and doubts
PostPosted: Fri Dec 14, 2007 9:44 am 
Newbie

Joined: Tue Nov 27, 2007 6:11 am
Posts: 12
Hi all,
first of all I'd like to thank very much developers for the great Hibernate Tools. I'm trying it with Eclipse 3.3 and I've got a few questions and doubts related to reverse engineering (I start from an existent database):
1) can the generated DAO classes be placed in another package and not within the same package of the DTO classes?
2) why the DAO classes use the apache commons? Don't you think that this can be annoying since you have to include the jar in your project?
3) I've got a couple of simple tables:
Code:
create table Person(
       personpk serial,    // primary key
       ...
       livingAddressPk references address(addresspk),
       officeAddressPk references address(addresspk),
       ....
)

create table address(
       addresspk serial,   // primary key
       street character varying(20),
       .....
)

that means a person has two links to two address "instances", but no link from address to person is included in such instances. However, the Java code generated is:
Code:
public class Address {
    private Set<Person> personsForBornaddresspk = new HashSet<Person>(0);
   private Set<Person> personsForOfficeaddresspk = new HashSet<Person>(0);
   private Set<Person> personsForLivingaddresspk = new HashSet<Person>(0);
     ....
}

why is the address class including links (multiple links) to Person instances? What if I don't want a reverse lookup? Does this costs to me when an address object is created (I mean, all the person must be associated to it...)?
4) the Home classes do not have a findall method, am I supposed to pass a null reference to the findByExample to get a loadAll semantic?

Thanks,
Luca


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 17, 2007 2:32 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
1) not at the current time - contributions welcome.
2) you mean the logging ? contributions welcome for alternate solution.
3) use reveng.xml or custom rev eng strategy to mark which foreignkeys you want collections for or not
4) contributions welcome.

In all honesty the DAO generation is not really good and could use a good cleanup....

_________________
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.  [ 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.