openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Spiro (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-2054) Constant join fails
Date Fri, 30 Sep 2011 16:28:45 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-2054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13118171#comment-13118171
] 

Michael Spiro commented on OPENJPA-2054:
----------------------------------------

A stack trace for this error:

<openjpa-2.1.0-r422266:1071316 fatal user error> org.apache.openjpa.persistence.ArgumentException:
"com.xxxxx.Xxx" defines a target of """1""" for join column "col_name", but that target does
not exist in table "dbname.tablename".
FailedObject: com.xxxxx.Xxxx@2f63e9a1 [java.lang.String]
	at org.apache.openjpa.jdbc.meta.MappingInfo.mergeJoinColumn(MappingInfo.java:1533)
	at org.apache.openjpa.jdbc.meta.MappingInfo.createJoins(MappingInfo.java:1322)
	at org.apache.openjpa.jdbc.meta.MappingInfo.createForeignKey(MappingInfo.java:1084)
	at org.apache.openjpa.jdbc.meta.FieldMappingInfo.getJoin(FieldMappingInfo.java:213)
	at org.apache.openjpa.jdbc.meta.FieldMappingInfo.getJoin(FieldMappingInfo.java:182)
	at org.apache.openjpa.jdbc.meta.FieldMapping.mapJoin(FieldMapping.java:585)
	at org.apache.openjpa.jdbc.meta.strats.HandlerCollectionTableFieldStrategy.map(HandlerCollectionTableFieldStrategy.java:108)
	at org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:146)
	at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:82)
	at org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:496)
	at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:461)
	at org.apache.openjpa.jdbc.meta.ClassMapping.resolveMapping(ClassMapping.java:854)
	at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1801)
	at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:822)
	at org.apache.openjpa.meta.MetaDataRepository.resolveMapping(MetaDataRepository.java:777)
	at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:657)
	at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:411)
	at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:384)
	at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:247)
	at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:104)
	at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3429)
	at org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1206)
	at org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:869)

                
> Constant join fails
> -------------------
>
>                 Key: OPENJPA-2054
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2054
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.1.0
>            Reporter: Michael Spiro
>              Labels: Constant, join
>
> According to the documentation (Part 3, chapter 7, paragraph 6), join criteria can be
defined so that a column in the source or target table must have some constant value. The
constant value should be specified in the attribute "referencedColumnName" of the @JoinColumn
annotation. If the constant is a string then its value should be enclosed first in single
quotes and then in double quotes like this:
> @JoinColumn(name="table.column", referencedColumnName="'value'")
> A numeric constant value needs just a single pair of double quotes:
> @JoinColumn(name="table.column", referencedColumnName="2")
> However a practical test shows that both options produce an error.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message