Hi,
I've created some CDTs with annotations for database table creation and persistence and run into an issue with naming a column in a join table.
Here is a code snippet from my CDT definition:
<xsd:element maxOccurs="unbounded" minOccurs="0" name="roleIds" type="xsd:int"> <xsd:annotation> <xsd:appinfo source="appian.jpa"> @OneToMany(cascade=CascadeType.ALL, indexed=false) @JoinTable(name="FSA_REQUESTED_SYSTEM_ROLE_JOIN") @JoinColumn(name="REQUESTED_SYSTEM_ID", referencedColumnName="ROLE_ID") </xsd:appinfo> </xsd:annotation> </xsd:element>
The issue is that the join table that's been created does not contain a ROLE_ID column, instead it has been called "elt", which is not a particularly helpful name.
Does anyone know how to fix this?
Discussion posts and replies are publicly visible
Have you tried something like this?
@JoinTable(name="FSA_REQUESTED_SYSTEM_ROLE_JOIN", joinColumns=@JoinColumn(name="REQUESTED_SYSTEM_ID"), inverseJoinColumns=@JoinColumn(name="ROLE_ID"))
Hi mikej117,
AFAIK After defining the relationship, need to click the Foreign Key icon for that field to further configure the relationship.(need to tick the checkbox "I know the name of the columns this field should use in the data base").Otherwise a random column name will be created in Data Base.
Please refer the below link for more info.
https://docs.appian.com/suite/help/18.3/CDT_Relationships.html
Thanks
Siva Chimata
Not valid for flat relationship scenario!
Doesn't work!
This is a pretty old post - if you're having an issue setting up your data structure, I'd suggest creating a new post with context for what you're trying to do and what isn't working.
Also just a quick note - usually if you have a flat data structure you don't even use annotations in your CDT. Instead, I'd recommend setting up the table structure that you want directly in the database and then create your CDTs from the already created table.