Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342038 - persistent.xml does not allow to specify unique constraints on tables
Summary: persistent.xml does not allow to specify unique constraints on tables
Status: RESOLVED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: Teneo (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Martin Taal CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-06 11:46 EDT by Thomas Schindl CLA
Modified: 2011-04-08 14:15 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schindl CLA 2011-04-06 11:46:30 EDT
I've started converting Ecore-Annotations to influence the hbm.xml and
DDL-Creation into the external persistence.xml to take care of
database-engine differences.

I've been successfull beside one minor thing. Using Ecore-Annotations
I've defined a Unique-Key on an EClass like this:

> >     <eAnnotations source="teneo.jpa">
> >       <details key="value" value="@Table(uniqueConstraints = {@UniqueConstraint(columnNames={&quot;LANGUAGECODE&quot;, &quot;COUNTRYCODE&quot;,&quot;VARIANT&quot;})})"/>
> >     </eAnnotations>
but I'm unable to port this over to the annotation.xml-File where I've
tried it like this:

> > 			<p:table>
> > 				<p:unique-constraint>LANGUAGECODE,COUNTRYCODE,VARIANT</p:unique-constraint>
> > 			</p:table>
But when generating this results in an CCE shown below:

> > INFO: Class loader strategy set to: org.eclipse.emf.teneo.classloader.ContextClassLoaderStrategy
> > java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Collection
> > 	at org.eclipse.emf.teneo.annotations.pannotation.impl.UniqueConstraintImpl.eSet(UniqueConstraintImpl.java:97)
> > 	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1081)
> > 	at org.eclipse.emf.teneo.annotations.xml.XmlPersistenceContentHandler.characters(XmlPersistenceContentHandler.java:386)
> > 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.characters(Unknown Source)
> > 	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.characters(Unknown Source)
> > 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
> > 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
> > 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
> > 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
> > 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
> > 	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
> > 	at javax.xml.parsers.SAXParser.parse(Unknown Source)
> > 	at javax.xml.parsers.SAXParser.parse(Unknown Source)
> > 	at org.eclipse.emf.teneo.annotations.xml.XmlPersistenceMapper.applyPersistenceMapping(XmlPersistenceMapper.java:109)
> > 	at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:157)
> > 	at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:73)
> > 	at org.eclipse.emf.teneo.hibernate.HbHelper.generateMapping(HbHelper.java:204)
> > 	at com.bizerba.retail.model.devtool.HbmGenerateAction.generateHbmXML(HbmGenerateAction.java:82)
> > 	at com.bizerba.retail.model.devtool.HbmGenerateAction.createFirebird(HbmGenerateAction.java:123)
> > 	at com.bizerba.retail.model.devtool.HbmGenerateAction.run(HbmGenerateAction.java:195)
Comment 1 Martin Taal CLA 2011-04-08 14:15:55 EDT
Fixed and new build published.