-->
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.  [ 1 post ] 
Author Message
 Post subject: Schema creation failed on HSQLDB server
PostPosted: Wed Jan 02, 2008 6:24 am 
Newbie

Joined: Wed Jan 02, 2008 6:11 am
Posts: 6
Hi Guys

I am trying to create a many to many relationship between two classes. Code for manytomany is

@Entity (name = "User")
@Table(name = "User")
public class User implements Serializable {

@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")
private String id;

@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinTable(name = "UserAddress", joinColumns = {@JoinColumn(name = "userId" )},
inverseJoinColumns = {@JoinColumn(name = "addressId")})/**/
private Collection<Address> addresses;

}

@Entity (name = "Address")
@Table (name = "Address")
public class Address implements Serializable {

@Id
@GeneratedValue(generator="system-uuid")
@GenericGenerator(name="system-uuid", strategy = "uuid")
private String id;

@ManyToMany(mappedBy = "addresses", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private Collection<User> users;
}

Unfortunately I am getting this error.
**** 01-02@10:51:19 ERROR (SchemaExport.java:274) - Unsuccessful: alter table UserAddress add constraint FK58FEBCBB1A82126F foreign key (addressId) references Address

I am using HSQLDB with annotations for my unit testing.

Can any body help me in this regard.


Best Regards


Farooq Ahmad


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

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.