Hello,
i think there is an error in the generation of the JPA annotation in a
many-to-many relation when i change the name of the databaseTable for a
entity.
here is my mode:
Entity User
{
scaffold
databaseTable = "USERDATA"
String lastName length="256";
String firstName length="256";
- List<@ContactChannel> contactChannels cascade="all-delete-orphan";
}
ValueObject ContactChannel
{
String identifier length="256";
Boolean business;
String addon nullable length="256";
}
here is a part of the generated DDL for Oracle :
CREATE TABLE CONTACTCHANNEL (
ID NUMBER(19) NOT NULL,
IDENTIFIER VARCHAR2(256) NOT NULL,
BUSINESS CHAR(1) NOT NULL,
ADDON VARCHAR2(256),
UUID VARCHAR2(36) NOT NULL
);
CREATE TABLE USERDATA (
ID NUMBER(19) NOT NULL,
LASTNAME VARCHAR2(256) NOT NULL,
FIRSTNAME VARCHAR2(256) NOT NULL,
UUID VARCHAR2(36) NOT NULL,
CREATEDDATE DATE,
CREATEDBY VARCHAR2(50),
LASTUPDATED DATE,
LASTUPDATEDBY VARCHAR2(50),
VERSION NUMBER(19) NOT NULL
);
-- Create many to many relations
CREATE TABLE CONTACTCHANNEL_USERDATA (
CONTACTCHANNEL NUMBER(19) NOT NULL,
USERDATA NUMBER(19) NOT NULL
);
here is a part of the generated java (User.java):
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "CONTACTCHANNEL_USERDATA", joinColumns =
@JoinColumn(name = "USER")
, inverseJoinColumns = @JoinColumn(name = "CONTACTCHANNEL")
)
@ForeignKey(name = "FK_CONTACTCHANNEL_USERDATA_USER", inverseName =
"FK_CONTACTCHANNEL_USERDATA_CONTACTCHANNEL")
@Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
@NotNull
private List<ContactChannel> contactChannels =
new ArrayList<ContactChannel>();
The Problem is the @JoinColumn annotation. It says that the name of the
JoinColumn is "USER" but it should be "USERDATA".
Markus
--
View this message in context:
http://old.nabble.com/Sculptor-1.8.0-wrong-annotation-for-ManyToMany-and-own-databaseTable-tp28223373s17564p28223373.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer