Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating Hibernate POJO classes using ANT SCRIPT

I am generating hibernate pojo classes with annotations from existing tables using Ant Script. I am stuck with a problem. Problem is that Generated class contains

@Table(name="person", catalog="db1")
public class Person
{
//properties
//getter-setter methods
}

and I want to remove catalog="db1" while auto generation. I can remove manually catalog="db1" from code but I dont want that. How should I write ANT SCRIPT ? Please help.

Thanks in advance.

like image 915
Nandkumar Tekale Avatar asked Aug 21 '26 16:08

Nandkumar Tekale


1 Answers

Add following line in your hibernate.cfg.xml file

<property name="default_catalog">db1</property>

And in hibernate.reveng.xml use

<table name="person"></table>

Instead of

<table catalog="db1" name="person"></table>
like image 105
Avinash T. Avatar answered Aug 24 '26 06:08

Avinash T.