Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.1 beta 3, annotations 3.1 beta 5
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
I've noticed that the columnNames for @UniqueConstraint of a table requires actual column names and not the property names. Does this not defeat the purpose of allowing a custom naming strategy because I end up hard coding column names when I define the unique constraints?
Code:
// only using one column for the unique constraint as an example
@Entity
@Table(uniqueConstraints={@UniqueConstraint(columnNames={"my_class_b_id"})})
public class MyClassA
{
private MyClassB myClassB;
@ManyToOne
public MyClassB getMyClassB()
{
return myClassB;
}
}
@Entity
public class MyClassB
{
private Long myClassBId;
@Id(generate = GeneratorType.AUTO)
public Long getMyClassBId()
{
return myClassBId;
}
}
I've tried using:
Code:
@Table(uniqueConstraints={@UniqueConstraint(columnNames={"myClassB"})})
but this does not work. Any thoughts on this ?