You are right.
This information was missing in the previous post:
Code:
package es.ameba.gtsp.onetoone;
/**
* @hibernate.class
*/
public class Street {
private String name;
private int number;
private Long id;
public Street() {}
public Street(String name, int number) {
this.name = name;
this.number = number;
}
/**
* @hibernate.id
* generator-class="hilo"
* unsaved-value="null"
*/
public Long getId() {return id;}
public void setId(Long id) {this.id = id;}
/**
* @hibernate.property
*/
public String getName() {return name;}
public void setName(String name) {this.name = name;}
/**
* @hibernate.property
*/
public int getNumber() {return number;}
public void setNumber(int number) {this.number = number;}
public String toString() {
return name +" " + number;
}
}
I have changed generator_class to:
Code:
/**
* @hibernate.id
* generator-class="identity"
* unsaved-value="null"
*/
recreated the table in MySql, activated "auto_increment", and now it's working fine.
Now we can start to replace our EJB entity beans with hibernate ;-)
A lot of thanks.
German R.