openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Schwarz <...@gmx.net>
Subject orm.xml / element-collection / trunk
Date Sun, 11 Jan 2009 18:45:05 GMT

Hi,


testing some of the advertised JPA2 features (see 
http://openjpa.apache.org/2008/12/23/openjpa-20-iteration-1-is-complete.html
http://openjpa.apache.org/2008/12/23/openjpa-20-iteration-1-is-complete.html
) I came across an issue with collections of primitives:

model:

entity Person with fields long id, String firstName, String lastName,
Set&lt;String> addresses

mapping is done via orm.xml:

&lt;entity class="....model.Person" name="Person" access="FIELD">
	&lt;table name="PERSON" />
	&lt;attributes>
		&lt;id name="id">
			&lt;generated-value strategy="SEQUENCE" />
		&lt;/id>
		&lt;element-collection name="addresses" />
	&lt;/attributes>
&lt;/entity>


This gives me an irritating exception about missing metadata for firstName
and lastName:

Exception in thread "main" 
org.apache.openjpa.persistence.ArgumentException: Fields
"....Person.firstName, ....model.Person.lastName" are not a default
persistent type, and do not have any annotations indicating their
persistence strategy.  If you do not want these fields to be persisted,
annotate them with @Transient.
	at
org.apache.openjpa.persistence.PersistenceMetaDataFactory.validateStrategies(PersistenceMetaDataFactory.java:399)
	at
org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:205)
	at
org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:474)
	at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:294)
	at
org.apache.openjpa.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:286)
	at
org.apache.openjpa.jdbc.meta.MappingTool.getMapping(MappingTool.java:676)
	at
org.apache.openjpa.jdbc.meta.MappingTool.buildSchema(MappingTool.java:748)
	at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:646)
	at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:153)
	at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:119)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:196)
	at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:197)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:150)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:61)
	at
oopex.openjpa2.jpa2.relationships.CollectionOfPrimitivesMain.insert(CollectionOfPrimitivesMain.java:69)
	at
oopex.openjpa2.jpa2.relationships.CollectionOfPrimitivesMain.main(CollectionOfPrimitivesMain.java:49)



A bug?


-- Frank
-- 
View this message in context: http://n2.nabble.com/orm.xml---element-collection---trunk-tp2142331p2142331.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message