Pranay Bhagde created OPENJPA-2550:
--------------------------------------

             Summary: Length of Join Columns
                 Key: OPENJPA-2550
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2550
             Project: OpenJPA
          Issue Type: Question
          Components: jpa
    Affects Versions: 2.3.0
            Reporter: Pranay Bhagde


Hi, 

we have observed a certain inconsistency in our schema creation scripts:

If we use a JPA join column on a column in another entity that has a restricted 
length, this length is not automatically used for the join column. 
We use OpenJPA maven plugin for generating DDL from the annotated entities.

Let me give you an example: 

JPA Entity Definitions: 

EssentialOrderDataBE:
@Id
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumns({
                  @JoinColumn(name = "EORD_CODE_CODEID", referencedColumnName = 
"CODE_CODEID", nullable = false),
                  @JoinColumn(name = "EORD_CODE_SLUN_NUMBER", 
referencedColumnName = "CODE_SLUN_NUMBER", nullable = false),
                  @JoinColumn(name = "EORD_CODE_GRAN_NUMBER", 
referencedColumnName = "CODE_GRAN_NUMBER", nullable = false),
                  @JoinColumn(name = "EORD_CODE_BMGR_NUMBER", 
referencedColumnName = "CODE_BMGR_NUMBER", nullable = false) })
    private CodeBE code;


CodeBE:
@Id
    @Column(name = "CODE_CODEID", length = 5)
    private String codeId;


In the database :
V1EREORD 
EORD_CODE_CODEID             VARCHAR        254
V1ERCODE
CODE_CODEID                        VARCHAR        5

Could you help us in finding answers to the following questions : 

Why is the openjpa transformater which we are using not using the correct 
length for the join column ? 
How can we make it work ? Adjust the Entities ? Additional configuration ? …




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to