-->
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.  [ 1 post ] 
Author Message
 Post subject: POJO Generation Missing Methods
PostPosted: Mon Feb 07, 2011 11:22 am 
Newbie

Joined: Mon Feb 07, 2011 11:17 am
Posts: 5
Hibernate Tools plugin (version 3.2.4) for eclipse

Hi all,
I'm using the plugin to reverse engineer my POJOs and DAOs from my DB-Schema and for some reason the toString,equals and hashcode methods aren't created in the POJOs.
What I'm doing is the following:
Create a new JPA project.
Configure it's persistence.xml file as follows:
<persistence-unit name="PU">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="hibernate.connection.password" value="pass"/>
<property name="hibernate.connection.url" value="jdbc:sqlserver://****:1433;DatabaseName=myDB"/>
<property name="hibernate.connection.username" value="user"/>
<property name="hibernate.default_catalog" value="myDB"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
<property name="hibernate.connection.schema" value="dbo"/>

<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="false"/>

Created a hibernate.reveng.xml file to only select my dbo scehma in my catalog.
Then created a Hibernate Console Configuration with type as JPA and the connection to be taken from the JPA config, and lastly configured the Persistence unit.
Used the Hibernate Code Generation configurations to create a new config where I enabled the "Reverse engineer from JDBC Connection" defined the output directory, package and reveng file.
In addition I checked all the checkboxes in that tab (apart from use custom templates).
In the exporters tab I used:
1. Use Java 5 syntax.
2. Generate EJB3 annotations.
and used the "Domain code" and "DAO code" exporters.
This works fine (after solving some problems with the DTP plugin compatibality).
The main problem is that I see in the Pojo.ftl the following expressions:
<#include "PojoToString.ftl"/>
<#include "PojoEqualsHashcode.ftl"/>
and in the PojoToString.ftl I see:
<#if pojo.needsToString()>
Where can I set this property? I want all my pojos to need toString,equals and hashcode?
Please, has anyone been able to generate entities with these methods...

Thank you in advance


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.