-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: @UniqueConstraint's columnNames requiring actual col names
PostPosted: Wed Sep 28, 2005 12:08 pm 
Beginner
Beginner

Joined: Mon Mar 28, 2005 12:58 pm
Posts: 27
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 ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 30, 2005 4:34 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I know, that sucks :-(

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.