Hibernate version:
3.2
Name and version of the database you are using:
Oracle 10g
Hi,
I got the following problem
I am generating primary Keys (Id) with the help of an extra table ("HIBERNATE_KEY_TABLE")
[HTML]
/**
* gets Id (primary key)
*
* @return id Id (primary key)
*/
@Id
@TableGenerator(name = "TABLENAME_GENERATOR", table = "HIBERNATE_KEY_TABLE",pkColumnName = "TABLE_NAME", valueColumnName = "NEXT_VALUE", pkColumnValue = "TABLENAME",allocationSize = 1)
@GeneratedValue(strategy = GenerationType.TABLE, generator = "TABLENAME_GENERATOR")
@Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true, precision = 10)
public long getId() {
return this.id;
}
/**
* sets Id (primary key)
*
* @param id Id (primary key)
*/
public void setId(long id) {
this.id = id;
}
[/HTML]
This iw working fine so far. The persist of an entity is ok, but if I try to get the Id with getId() I receive "0" instead of the original Id.
[HTML]
/* persist the object */
manager.persist(brain);
long id = brain.getId();
[/HTML]
Any ideas?
Tns in advance,
Markus
|