Hello,
I try to generate EJB3 POJOs from postgresql.
With this kind of table:
Code:
CREATE TABLE hotel
(
id serial NOT NULL,
....
)
I have the following code generated
Code:
@Entity
@Table(name="hotel"
)
public class Hotel implements java.io.Serializable {
private int id;
@Column(name="id", unique=true, nullable=false)
public int getId() {
return this.id;
}
The id is not referenced as 'assigned'.
Thats my ant task
Code:
<hibernatetool destdir="${build.dir}">
<jdbcconfiguration configurationfile="${src.dir}/hibernate.cfg.xml"
packagename="fr.ccip.booking"
/>
<!-- Generate hm files -->
<hbm2java destdir="${build.dir}" jdk5="true" ejb3="true"/>
</hibernatetool>
How may I change this generation like this
Code:
@Entity
@Name("booking")
@Table(name = "Booking" )
@SequenceGenerator(name = "booking_sequence", sequenceName = "booking_id_seq")
public class Booking implements Serializable {
private Long id;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "booking_sequence")
public Long getId() {
return id;
}
Thanks
Hibernate tools version: 3.2.0b9
Name and version of the database you are using: Postgres 8.1