Fixed in trunk.

If you need a workaround for 1.8.0 you can add this to SpecialCases.ext:
extension extensions::helper;
around extensions::dbhelper::getOppositeForeignKeyName(Reference ref) :
        ref.hasHint("joinColumnName") ? 
                ref.getHint("joinColumnName") : 
                ctx.proceed();

in model.btdesign you use the hint:
- Set<@ContactChannel> contactChannels cascade="all-delete-orphan"
hint="joinColumnName=USERDATA";

Another thing. You can't use List for this type of unidirectional to-many
association. I suggest that you use a Bag or Set. If you need List you
should first look at this issue:
http://fornax.itemis.de/jira/browse/CSC-377
and maybe also this
http://fornax.itemis.de/jira/browse/CSC-491

/Patrik


Patrik Nordwall wrote:
> 
> Thank you for a descriptive bug report. I have added it to jira and
> started to look at it. http://fornax.itemis.de/jira/browse/CSC-494
> I have reproduced with junit test and I think I have a solution. I need to
> verify a llittle bit more.
> 
> /Patrik
> 
> Markus Flögel wrote:
>> 
>> 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-tp28223373s17564p28246623.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Download Intel&#174; 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
Fornax-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to