We use Hibernate Annotations 3.4.0GA and Hibernate Core 3.3.2.GA (also known as current stable versions) for the Oracle database
We have a one-to-many mapping with base = 1, which worked fine for some time, but last week we found several records in the database where the index column was 0, which caused all kinds of problems.
So my question is: does anyone know of a way to get the value 0 in the one-to-many relationship index column when it maps to base = 1? Perhaps due to the use of generics or MappedSuperclass.
Please note that the code is rather complicated, since inheritance is also involved.
The following are relevant class fragments:
@MappedSuperclass
public abstract class AbstractReihung<Tp, Tw, Te extends AbstractReihungElement<Tp, Tw>>
{
@OneToMany(cascade = CascadeType.ALL)
@Cascade(
{
org.hibernate.annotations.CascadeType.ALL,
org.hibernate.annotations.CascadeType.DELETE_ORPHAN
})
@JoinColumn(name = "parent_id", nullable = false)
@IndexColumn(name = "position", base = 1, nullable = false)
private List<Te> elements = new ArrayList<Te>();
}
@MappedSuperclass
public abstract class AbstractReihungElement<Tp, Tw> extends AbstractDbObject
{
@ManyToOne
@JoinColumn(name = "parent_id", insertable = false, updatable = false, nullable = false)
private Tp parent;
@Column(name = "position", insertable = false, updatable = false, nullable = false)
private int position;
}
. Entity. , , .