Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] Multivalued EAttributes of EDataTypes do not have the correct Hibernate mapping
[Teneo] Multivalued EAttributes of EDataTypes do not have the correct Hibernate mapping [message #604770] Tue, 17 April 2007 03:51
Michael Kanaley is currently offline Michael Kanaley
Messages: 89
Registered: July 2009
Member
Hello Martin,
I have attached a bundle that you can directly import into Eclipse.
I have removed hibernate and other third party JARs to keep the attachment
small so it will not run until you put all the jars in the lib directory.
It uses HSQLDB and the latest 0.7.5 Teneo.
I can send you the jars if necessary.
It will add a launcher called test.teneo.multidatatype.

This model plugin has one class called SomeClass that has a single
EAttribute called "myProperty" of type SomeEnum that has
upperbound of -1. Teneo is creating a mapping for this attribute of the
form:
<list name="myProperty" lazy="true" cascade="all,delete-orphan">

<key update="true">

<column name="`someclass_myproperty_e_id`" not-null="true" unique="false"/>

</key>

<list-index column="`someclass_myproperty_idx`"/>

<element type="test.teneo.multidatatype.SomeEnum"/>

</list>

When I try to persist an instance of this model, the exception at the end of
this message is
thrown. Unfortunately, the type should be refering to a typedef instead of
the custom EDataType class.
The list mapping should have had an element of the form:
<element type="multidatatype.SomeEnum"/>

The typedef multidatatype.SomeEnum should have been declared like:
<typedef name="multidatatype.SomeEnum"
class=" org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype ">

<param
name="epackage">http://xsd.example.org/test/multidatatype</param>

<param name="edatatype">SomeEnum</param>

</typedef>


Fortunately, there is a simple workaround by declaring an annotation on the
SomeEnum EDataType of the form:
@TypeDef(
name="multidatatype.SomeEnum",
typeClass =
org.eclipse.emf.teneo.hibernate.mapping.DefaultToStringUserT ype,
parameters = {
@Parameter(name="epackage",
value="http://xsd.example.org/test/multidatatype")
@Parameter(name="edatatype", value="SomeEnum")
}
)

Please let me know if this is considered a bug and I will file a bugzilla.
Thanks,
-mike

org.hibernate.MappingException: Could not determine type for:
test.teneo.multidatatype.SomeEnum, for columns:
[org.hibernate.mapping.Column(elt)]

at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 66)

at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)

at org.hibernate.mapping.Column.getSqlType(Column.java:182)

at org.hibernate.mapping.Table.sqlCreateString(Table.java:383)

at
org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:884)

at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)

at
org.eclipse.emf.teneo.hibernate.HbDataStore.updateDatabaseSc hema(HbDataStore.java:478)

at
org.eclipse.emf.teneo.hibernate.HbDataStore.initialize(HbDat aStore.java:180)

at test.teneo.MapTests.createHbDataStore(MapTests.java:72)

at test.teneo.MapTests.testSaving(MapTests.java:86)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at junit.framework.TestCase.runTest(TestCase.java:154)

at junit.framework.TestCase.runBare(TestCase.java:127)

at junit.framework.TestResult$1.protect(TestResult.java:106)

at junit.framework.TestResult.runProtected(TestResult.java:124)

at junit.framework.TestResult.run(TestResult.java:109)

at junit.framework.TestCase.run(TestCase.java:118)

at junit.framework.TestSuite.runTest(TestSuite.java:208)

at junit.framework.TestSuite.run(TestSuite.java:203)

at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer ence.run(JUnit3TestReference.java:128)

at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:196)


Previous Topic:ClassCastExeption with Elistwrapper
Next Topic:GMF(Callisto) 1.0.3: org.eclipse.emf.validation.ocl requires "org.eclipse.ocl.ecore" ????
Goto Forum:
  


Current Time: Thu Sep 18 07:55:35 GMT 2014

Powered by FUDForum. Page generated in 0.02939 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software