-->
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: Specifiying different packages for Pojos and DAO
PostPosted: Mon Sep 20, 2010 8:37 pm 
Newbie

Joined: Fri Jul 11, 2008 11:39 pm
Posts: 7
Hi,
I'd like to know if there is a way to have hbm2java and hbm2dao output files with different package names?
Currently i have them configured in my pom.xml as...

Code:
<component>
   <name>hbm2java</name>
       <implementation>configuration</implementation>
        <outputDirectory>/src/main/java/</outputDirectory>
/component>
<component>
       <name>hbm2dao</name>
       <implementation>configuration</implementation>
        <outputDirectory>/src/main/java/</outputDirectory>
</component>

<componentProperties>
       <propertyfile>/src/main/resources/database.properties</propertyfile>
       <packagename>com.myapp.data.models</packagename>
</componentProperties>


The above obviously causes the DAO generated classes to be placed in my models package when i would ideally like to have them in a DAO package.
Any solution to this problem would be appreciated


Top
 Profile  
 
 Post subject: Re: Specifiying different packages for Pojos and DAO
PostPosted: Tue Sep 21, 2010 5:53 am 
Senior
Senior

Joined: Fri May 08, 2009 12:27 pm
Posts: 168
There may be a better way to do this, but I'd copy Eclipse's Hibernate Code Generation Configuration, one for hbm2dao and one for hbm2pojo.

Or you may consider restructuring the code so that it uses just one of DAO or POJO, if that's an option. It's certainly not necessary to have both access paths within one application; in fact, I suspect you may be confusing Hibernate's first-level cache if you're doing access through DAO, and disabling Hibernate's update batching optimisations as well.


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.