FB18 - Das Forum für Informatik

fb18.de / Off-Topic / Hard- und Softwarefragen

hibernate problem / bug???

hibernate problem / bug??? 2009-01-22 14:40
Anonymer User
Moin moin,

ich hab ein kleines Problem mit hibernate annotations.

Ich hab 2 Klassen :

public class A{

@Id
int id;

@Column(nullable=false)
String name;
//….
}

public class B{

@Id
int id;

@CollectionOfElements(fetch=FetchType.LAZY)
@org.hibernate.annotations.MapKey(columns = @Column(name = "erfasst_am", nullable = false), type = @Type(type = "org.hibernate.type.DateType"))
@JoinTable(name = "pc", joinColumns = @JoinColumn(name = "pl_id", referencedColumnName = "pl_id",nullable=false),inverseJoinColumns=@JoinColumn(name="cl_id",nullable=true,unique=false))
public Map<Date, A> getPc() {
return pc;
//…
}

Mir wird dafuer folgendes DDL SChema generiert:


create table Pl (pl_id integer not null, name varchar(30), primary key (pl_id))
create table cl (Cl_id integer not null, name varchar(25) not null, primary key (Club_id))
create table pcs (pl_id integer not null, cl_id integer not null, erfasst_am date not null, primary key (pl_id, erfasst_am), unique (cl_id))

So weit so gut, aber wo kommt dieses "unique (cl_id)" her?
Oder wie bekomm ich das unique weg?

Die add constraints aus der ddl hab ich weggelassen, die erzeugen die richtigen referenzen.

Das habe ich uebrigens auch schon veruscht:

@CollectionOfElements(fetch=FetchType.LAZY)
@org.hibernate.annotations.MapKey(columns = @Column(name = "erfasst_am", nullable = false), type = @Type(type = "org.hibernate.type.DateType"))
@JoinTable(name = "pc", joinColumns = @JoinColumn(name = "pl_id", referencedColumnName = "pl_id",nullable=false))
@JoinColumn(name="cl_id",nullable=true,unique=false)


mfg Finni

RE: hibernate problem / bug??? 2009-01-22 17:29
Anonymer User
Hat sich zwar nicht erledigt, aber ist wohl bekannt
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3410