Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo] Missed something in generation?
[Teneo] Missed something in generation? [message #424487] Tue, 28 October 2008 11:44 Go to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Hi,

I cannot see what has changed, but the code that once worked no longer
works.

From my previous example of User many to many to Role I made the
changes to the annotation to use ecore:reference, ecore:opposite and
@ManyToMany. I then reload... to genmodel, then right clicked the
..genmodel and generated Model code, then copied the ecore file to the
bin directory. Then I ran this.

// create the DataStore
dataStore = HbHelper.INSTANCE.createRegisterDataStore(HBNAME);

// set persistence options
Properties props = new Properties();
props.setProperty(PersistenceOptions.MAXIMUM_SQL_NAME_LENGTH ,
"30");
props.setProperty(PersistenceOptions.ID_FEATURE_AS_PRIMARY_K EY,
"true");
props.setProperty(PersistenceOptions.DEFAULT_ID_FEATURE_NAME ,
"id");

props.setProperty(PersistenceOptions.JOIN_COLUMN_NAMING_STRA TEGY, "simple");

//props.setProperty(PersistenceOptions.JOIN_TABLE_FOR_NON_CO NTAINED_ASSOCIATIONS,
"false");
props.setProperty(PersistenceOptions.ALSO_MAP_AS_CLASS, "false");
props.setProperty(PersistenceOptions.DEFAULT_TEMPORAL_VALUE,
"DATE");

props.setProperty(PersistenceOptions.DISABLE_ECONTAINER_MAPP ING, "true");
props.setProperty(PersistenceOptions.ALWAYS_VERSION, "false");
props.setProperty(PersistenceOptions.ALWAYS_MAP_LIST_AS_BAG,
"true");
props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
"JOINED");

// configure the EPackages used by this dataStore
dataStore.setEPackages(new EPackage[] { secmsecurityPackage.eINSTANCE });

// load hibernate properties
try
{
props.load(HibernateUtil.class.getResourceAsStream(HBPROPERT IES));
props.setProperty("hibernate.hbm2ddl.auto", shouldInit ? "update" :
"validate"); // create/validate/update
}
catch (Throwable t)
{
// log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + t);
throw new ExceptionInInitializerError(t);
}
dataStore.setProperties(props);

if (shouldInit)
{
// initialise the datastore
dataStore.initialize();
}

// get the session factory from the teneo hibernate datastore
sessionFactory = dataStore.getSessionFactory();
Session sess = sessionFactory.getCurrentSession();
Transaction tx = sess.beginTransaction();

try
{
User user = (User) sess.load(User.class, new Integer(1));
....

I get a org.hibernate.MappingException: Unknown entity:
com.stpware.secmsecurity.User

I check the path and the generated in memory hibernate.hbm.xml in the
build log for Teneo, the class is there.

here is the in memory User object from the Teneo build log

<class entity-name="User" abstract="false" lazy="false" table="`user`">
<meta attribute="eclassName">User</meta>
<meta attribute="epackage">http://www.stpware.com/secmsecurity</meta>
<id name="id" type="int" unsaved-value="0">
<column not-null="true" unique="false" name="`id`"/>
<generator class="identity"/>
</id>
<bag name="userPref" lazy="true" cascade="all,delete-orphan">
<key update="true" foreign-key="user_userpref">
<column name="`user`" not-null="false" unique="false"/>
</key>
<one-to-many entity-name="UserPref"/>
</bag>
<bag name="userGroup" lazy="true" inverse="true" table="`usergroup`">
<key update="true">
<column name="`user`" not-null="true" unique="false"/>
</key>
<many-to-many entity-name="Group" unique="false"
foreign-key="user_usergroup">
<column name="`group`" not-null="true" unique="false"/>
</many-to-many>
</bag>
<bag name="userRole" lazy="true" inverse="true" table="`userrole`">
<key update="true">
<column name="`user`" not-null="true" unique="false"/>
</key>
<many-to-many entity-name="Role" unique="false"
foreign-key="user_userrole">
<column name="`role`" not-null="true" unique="false"/>
</many-to-many>
</bag>
<property name="email" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`email`"/>
</property>
<property name="firstName" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`firstname`"/>
</property>
<property name="lastLogin" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="date">
<column not-null="false" unique="false" name="`lastlogin`"/>
</property>
<property name="loginName" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`loginname`"/>
</property>
<property name="password" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`password`"/>
</property>
<property name="phone" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`phone`"/>
</property>
<property name="salutation" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`salutation`"/>
</property>
<property name="surname" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`surname`"/>
</property>
<property name="userEnd" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="date">
<column not-null="false" unique="false" name="`userend`"/>
</property>
<property name="userStart" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="date">
<column not-null="false" unique="false" name="`userstart`"/>
</property>
</class>

I cannot see what is missing?

David
Re: [Teneo] Missed something in generation? [message #424488 is a reply to message #424487] Tue, 28 October 2008 13:10 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi David,
And if you set this property to:
props.setProperty(PersistenceOptions.ALSO_MAP_AS_CLASS, "false");
true?

Is there a specific reason why you have it on false?

gr. Martin

David Wynter wrote:
> Hi,
>
> I cannot see what has changed, but the code that once worked no longer
> works.
>
> From my previous example of User many to many to Role I made the
> changes to the annotation to use ecore:reference, ecore:opposite and
> @ManyToMany. I then reload... to genmodel, then right clicked the
> ..genmodel and generated Model code, then copied the ecore file to the
> bin directory. Then I ran this.
>
> // create the DataStore
> dataStore = HbHelper.INSTANCE.createRegisterDataStore(HBNAME);
>
> // set persistence options
> Properties props = new Properties();
>
> props.setProperty(PersistenceOptions.MAXIMUM_SQL_NAME_LENGTH , "30");
>
> props.setProperty(PersistenceOptions.ID_FEATURE_AS_PRIMARY_K EY, "true");
>
> props.setProperty(PersistenceOptions.DEFAULT_ID_FEATURE_NAME , "id");
> props.setProperty(PersistenceOptions.JOIN_COLUMN_NAMING_STRA TEGY,
> "simple");
>
> //props.setProperty(PersistenceOptions.JOIN_TABLE_FOR_NON_CO NTAINED_ASSOCIATIONS,
> "false");
> props.setProperty(PersistenceOptions.ALSO_MAP_AS_CLASS,
> "false");
> props.setProperty(PersistenceOptions.DEFAULT_TEMPORAL_VALUE,
> "DATE");
> props.setProperty(PersistenceOptions.DISABLE_ECONTAINER_MAPP ING,
> "true");
> props.setProperty(PersistenceOptions.ALWAYS_VERSION, "false");
> props.setProperty(PersistenceOptions.ALWAYS_MAP_LIST_AS_BAG,
> "true");
> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
> "JOINED");
>
> // configure the EPackages used by this dataStore
> dataStore.setEPackages(new EPackage[] { secmsecurityPackage.eINSTANCE });
>
> // load hibernate properties
> try
> {
>
> props.load(HibernateUtil.class.getResourceAsStream(HBPROPERT IES));
> props.setProperty("hibernate.hbm2ddl.auto", shouldInit ?
> "update" : "validate"); // create/validate/update
> }
> catch (Throwable t)
> {
> // log the exception, as it might be swallowed
> System.err.println("Initial SessionFactory creation failed." + t);
> throw new ExceptionInInitializerError(t);
> }
> dataStore.setProperties(props);
>
> if (shouldInit)
> {
> // initialise the datastore
> dataStore.initialize();
> }
>
> // get the session factory from the teneo hibernate datastore
> sessionFactory = dataStore.getSessionFactory();
> Session sess = sessionFactory.getCurrentSession();
> Transaction tx = sess.beginTransaction();
>
> try
> {
> User user = (User) sess.load(User.class, new Integer(1));
> ....
>
> I get a org.hibernate.MappingException: Unknown entity:
> com.stpware.secmsecurity.User
>
> I check the path and the generated in memory hibernate.hbm.xml in the
> build log for Teneo, the class is there.
>
> here is the in memory User object from the Teneo build log
>
> <class entity-name="User" abstract="false" lazy="false" table="`user`">
> <meta attribute="eclassName">User</meta>
> <meta
> attribute="epackage">http://www.stpware.com/secmsecurity</meta>
> <id name="id" type="int" unsaved-value="0">
> <column not-null="true" unique="false" name="`id`"/>
> <generator class="identity"/>
> </id>
> <bag name="userPref" lazy="true" cascade="all,delete-orphan">
> <key update="true" foreign-key="user_userpref">
> <column name="`user`" not-null="false" unique="false"/>
> </key>
> <one-to-many entity-name="UserPref"/>
> </bag>
> <bag name="userGroup" lazy="true" inverse="true"
> table="`usergroup`">
> <key update="true">
> <column name="`user`" not-null="true" unique="false"/>
> </key>
> <many-to-many entity-name="Group" unique="false"
> foreign-key="user_usergroup">
> <column name="`group`" not-null="true" unique="false"/>
> </many-to-many>
> </bag>
> <bag name="userRole" lazy="true" inverse="true" table="`userrole`">
> <key update="true">
> <column name="`user`" not-null="true" unique="false"/>
> </key>
> <many-to-many entity-name="Role" unique="false"
> foreign-key="user_userrole">
> <column name="`role`" not-null="true" unique="false"/>
> </many-to-many>
> </bag>
> <property name="email" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`email`"/>
> </property>
> <property name="firstName" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`firstname`"/>
> </property>
> <property name="lastLogin" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="date">
> <column not-null="false" unique="false" name="`lastlogin`"/>
> </property>
> <property name="loginName" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`loginname`"/>
> </property>
> <property name="password" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`password`"/>
> </property>
> <property name="phone" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`phone`"/>
> </property>
> <property name="salutation" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`salutation`"/>
> </property>
> <property name="surname" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`surname`"/>
> </property>
> <property name="userEnd" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="date">
> <column not-null="false" unique="false" name="`userend`"/>
> </property>
> <property name="userStart" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="date">
> <column not-null="false" unique="false" name="`userstart`"/>
> </property>
> </class>
>
> I cannot see what is missing?
>
> David
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] Missed something in generation? [message #424493 is a reply to message #424488] Tue, 28 October 2008 14:27 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Hi Martin,

ALSO_MAP_AS_CLASS has always been false, changing it to true I get the
same exception.

Rgds,

David
Martin Taal wrote:
> Hi David,
> And if you set this property to:
> props.setProperty(PersistenceOptions.ALSO_MAP_AS_CLASS, "false");
> true?
>
> Is there a specific reason why you have it on false?
>
> gr. Martin
>
> David Wynter wrote:
>> Hi,
>>
>> I cannot see what has changed, but the code that once worked no longer
>> works.
>>
>> From my previous example of User many to many to Role I made the
>> changes to the annotation to use ecore:reference, ecore:opposite and
>> @ManyToMany. I then reload... to genmodel, then right clicked the
>> ..genmodel and generated Model code, then copied the ecore file to the
>> bin directory. Then I ran this.
>>
>> // create the DataStore
>> dataStore = HbHelper.INSTANCE.createRegisterDataStore(HBNAME);
>> // set persistence options
>> Properties props = new Properties();
>>
>> props.setProperty(PersistenceOptions.MAXIMUM_SQL_NAME_LENGTH , "30");
>>
>> props.setProperty(PersistenceOptions.ID_FEATURE_AS_PRIMARY_K EY, "true");
>>
>> props.setProperty(PersistenceOptions.DEFAULT_ID_FEATURE_NAME , "id");
>> props.setProperty(PersistenceOptions.JOIN_COLUMN_NAMING_STRA TEGY,
>> "simple");
>>
>> //props.setProperty(PersistenceOptions.JOIN_TABLE_FOR_NON_CO NTAINED_ASSOCIATIONS,
>> "false");
>> props.setProperty(PersistenceOptions.ALSO_MAP_AS_CLASS,
>> "false");
>>
>> props.setProperty(PersistenceOptions.DEFAULT_TEMPORAL_VALUE, "DATE");
>> props.setProperty(PersistenceOptions.DISABLE_ECONTAINER_MAPP ING,
>> "true");
>> props.setProperty(PersistenceOptions.ALWAYS_VERSION,
>> "false");
>>
>> props.setProperty(PersistenceOptions.ALWAYS_MAP_LIST_AS_BAG, "true");
>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>> "JOINED"); // configure the EPackages used by this dataStore
>> dataStore.setEPackages(new EPackage[] {
>> secmsecurityPackage.eINSTANCE });
>> // load hibernate properties
>> try
>> {
>>
>> props.load(HibernateUtil.class.getResourceAsStream(HBPROPERT IES));
>> props.setProperty("hibernate.hbm2ddl.auto", shouldInit
>> ? "update" : "validate"); // create/validate/update
>> }
>> catch (Throwable t)
>> {
>> // log the exception, as it might be swallowed
>> System.err.println("Initial SessionFactory creation failed." + t);
>> throw new ExceptionInInitializerError(t);
>> }
>> dataStore.setProperties(props);
>> if (shouldInit)
>> {
>> // initialise the datastore
>> dataStore.initialize();
>> }
>> // get the session factory from the teneo hibernate datastore
>> sessionFactory = dataStore.getSessionFactory();
>> Session sess = sessionFactory.getCurrentSession();
>> Transaction tx = sess.beginTransaction();
>>
>> try
>> {
>> User user = (User) sess.load(User.class, new Integer(1));
>> ....
>>
>> I get a org.hibernate.MappingException: Unknown entity:
>> com.stpware.secmsecurity.User
>>
>> I check the path and the generated in memory hibernate.hbm.xml in the
>> build log for Teneo, the class is there.
>>
>> here is the in memory User object from the Teneo build log
>>
>> <class entity-name="User" abstract="false" lazy="false"
>> table="`user`">
>> <meta attribute="eclassName">User</meta>
>> <meta
>> attribute="epackage">http://www.stpware.com/secmsecurity</meta>
>> <id name="id" type="int" unsaved-value="0">
>> <column not-null="true" unique="false" name="`id`"/>
>> <generator class="identity"/>
>> </id>
>> <bag name="userPref" lazy="true" cascade="all,delete-orphan">
>> <key update="true" foreign-key="user_userpref">
>> <column name="`user`" not-null="false" unique="false"/>
>> </key>
>> <one-to-many entity-name="UserPref"/>
>> </bag>
>> <bag name="userGroup" lazy="true" inverse="true"
>> table="`usergroup`">
>> <key update="true">
>> <column name="`user`" not-null="true" unique="false"/>
>> </key>
>> <many-to-many entity-name="Group" unique="false"
>> foreign-key="user_usergroup">
>> <column name="`group`" not-null="true" unique="false"/>
>> </many-to-many>
>> </bag>
>> <bag name="userRole" lazy="true" inverse="true"
>> table="`userrole`">
>> <key update="true">
>> <column name="`user`" not-null="true" unique="false"/>
>> </key>
>> <many-to-many entity-name="Role" unique="false"
>> foreign-key="user_userrole">
>> <column name="`role`" not-null="true" unique="false"/>
>> </many-to-many>
>> </bag>
>> <property name="email" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`email`"/>
>> </property>
>> <property name="firstName" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`firstname`"/>
>> </property>
>> <property name="lastLogin" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="date">
>> <column not-null="false" unique="false" name="`lastlogin`"/>
>> </property>
>> <property name="loginName" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`loginname`"/>
>> </property>
>> <property name="password" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`password`"/>
>> </property>
>> <property name="phone" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`phone`"/>
>> </property>
>> <property name="salutation" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`salutation`"/>
>> </property>
>> <property name="surname" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.String">
>> <column not-null="false" unique="false" name="`surname`"/>
>> </property>
>> <property name="userEnd" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="date">
>> <column not-null="false" unique="false" name="`userend`"/>
>> </property>
>> <property name="userStart" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="date">
>> <column not-null="false" unique="false" name="`userstart`"/>
>> </property>
>> </class>
>>
>> I cannot see what is missing?
>>
>> David
>>
>
>
Re: [Teneo] Missed something in generation? [message #424494 is a reply to message #424493] Tue, 28 October 2008 14:37 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Hi,

HEre is the actual stack trace in case that gives you some hints.

org.hibernate.MappingException: Unknown entity:
com.stpware.secmsecurity.User
at
org.hibernate.impl.SessionFactoryImpl.getEntityPersister(Ses sionFactoryImpl.java:580)
at
org.hibernate.event.def.DefaultLoadEventListener.onLoad(Defa ultLoadEventListener.java:91)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905 )
at org.hibernate.impl.SessionImpl.load(SessionImpl.java:822)
at org.hibernate.impl.SessionImpl.load(SessionImpl.java:815)
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
org.hibernate.context.ThreadLocalSessionContext$TransactionP rotectionWrapper.invoke(ThreadLocalSessionContext.java:342)
at $Proxy0.load(Unknown Source)
at
com.stpware.secmsecurity.manager.HibernateUtil.main(Hibernat eUtil.java:115)

David

David Wynter wrote:
> Hi Martin,
>
> ALSO_MAP_AS_CLASS has always been false, changing it to true I get the
> same exception.
>
> Rgds,
>
> David
> Martin Taal wrote:
>> Hi David,
>> And if you set this property to:
>> props.setProperty(PersistenceOptions.ALSO_MAP_AS_CLASS,
>> "false");
>> true?
>>
>> Is there a specific reason why you have it on false?
>>
>> gr. Martin
>>
>> David Wynter wrote:
>>> Hi,
>>>
>>> I cannot see what has changed, but the code that once worked no
>>> longer works.
>>>
>>> From my previous example of User many to many to Role I made the
>>> changes to the annotation to use ecore:reference, ecore:opposite and
>>> @ManyToMany. I then reload... to genmodel, then right clicked the
>>> ..genmodel and generated Model code, then copied the ecore file to
>>> the bin directory. Then I ran this.
>>>
>>> // create the DataStore
>>> dataStore = HbHelper.INSTANCE.createRegisterDataStore(HBNAME);
>>> // set persistence options
>>> Properties props = new Properties();
>>>
>>> props.setProperty(PersistenceOptions.MAXIMUM_SQL_NAME_LENGTH , "30");
>>>
>>> props.setProperty(PersistenceOptions.ID_FEATURE_AS_PRIMARY_K EY, "true");
>>>
>>> props.setProperty(PersistenceOptions.DEFAULT_ID_FEATURE_NAME , "id");
>>>
>>> props.setProperty(PersistenceOptions.JOIN_COLUMN_NAMING_STRA TEGY,
>>> "simple");
>>>
>>> //props.setProperty(PersistenceOptions.JOIN_TABLE_FOR_NON_CO NTAINED_ASSOCIATIONS,
>>> "false");
>>> props.setProperty(PersistenceOptions.ALSO_MAP_AS_CLASS,
>>> "false");
>>>
>>> props.setProperty(PersistenceOptions.DEFAULT_TEMPORAL_VALUE, "DATE");
>>> props.setProperty(PersistenceOptions.DISABLE_ECONTAINER_MAPP ING,
>>> "true");
>>> props.setProperty(PersistenceOptions.ALWAYS_VERSION,
>>> "false");
>>>
>>> props.setProperty(PersistenceOptions.ALWAYS_MAP_LIST_AS_BAG, "true");
>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>> "JOINED"); // configure the EPackages used by this dataStore
>>> dataStore.setEPackages(new EPackage[] {
>>> secmsecurityPackage.eINSTANCE });
>>> // load hibernate properties
>>> try
>>> {
>>>
>>> props.load(HibernateUtil.class.getResourceAsStream(HBPROPERT IES));
>>> props.setProperty("hibernate.hbm2ddl.auto",
>>> shouldInit ? "update" : "validate"); // create/validate/update
>>> }
>>> catch (Throwable t)
>>> {
>>> // log the exception, as it might be swallowed
>>> System.err.println("Initial SessionFactory creation failed." + t);
>>> throw new ExceptionInInitializerError(t);
>>> }
>>> dataStore.setProperties(props);
>>> if (shouldInit)
>>> {
>>> // initialise the datastore
>>> dataStore.initialize();
>>> }
>>> // get the session factory from the teneo hibernate datastore
>>> sessionFactory = dataStore.getSessionFactory();
>>> Session sess = sessionFactory.getCurrentSession();
>>> Transaction tx = sess.beginTransaction();
>>>
>>> try
>>> {
>>> User user = (User) sess.load(User.class, new Integer(1));
>>> ....
>>>
>>> I get a org.hibernate.MappingException: Unknown entity:
>>> com.stpware.secmsecurity.User
>>>
>>> I check the path and the generated in memory hibernate.hbm.xml in the
>>> build log for Teneo, the class is there.
>>>
>>> here is the in memory User object from the Teneo build log
>>>
>>> <class entity-name="User" abstract="false" lazy="false"
>>> table="`user`">
>>> <meta attribute="eclassName">User</meta>
>>> <meta
>>> attribute="epackage">http://www.stpware.com/secmsecurity</meta>
>>> <id name="id" type="int" unsaved-value="0">
>>> <column not-null="true" unique="false" name="`id`"/>
>>> <generator class="identity"/>
>>> </id>
>>> <bag name="userPref" lazy="true" cascade="all,delete-orphan">
>>> <key update="true" foreign-key="user_userpref">
>>> <column name="`user`" not-null="false" unique="false"/>
>>> </key>
>>> <one-to-many entity-name="UserPref"/>
>>> </bag>
>>> <bag name="userGroup" lazy="true" inverse="true"
>>> table="`usergroup`">
>>> <key update="true">
>>> <column name="`user`" not-null="true" unique="false"/>
>>> </key>
>>> <many-to-many entity-name="Group" unique="false"
>>> foreign-key="user_usergroup">
>>> <column name="`group`" not-null="true" unique="false"/>
>>> </many-to-many>
>>> </bag>
>>> <bag name="userRole" lazy="true" inverse="true"
>>> table="`userrole`">
>>> <key update="true">
>>> <column name="`user`" not-null="true" unique="false"/>
>>> </key>
>>> <many-to-many entity-name="Role" unique="false"
>>> foreign-key="user_userrole">
>>> <column name="`role`" not-null="true" unique="false"/>
>>> </many-to-many>
>>> </bag>
>>> <property name="email" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`email`"/>
>>> </property>
>>> <property name="firstName" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`firstname`"/>
>>> </property>
>>> <property name="lastLogin" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="date">
>>> <column not-null="false" unique="false" name="`lastlogin`"/>
>>> </property>
>>> <property name="loginName" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`loginname`"/>
>>> </property>
>>> <property name="password" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`password`"/>
>>> </property>
>>> <property name="phone" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`phone`"/>
>>> </property>
>>> <property name="salutation" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false"
>>> name="`salutation`"/>
>>> </property>
>>> <property name="surname" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="java.lang.String">
>>> <column not-null="false" unique="false" name="`surname`"/>
>>> </property>
>>> <property name="userEnd" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="date">
>>> <column not-null="false" unique="false" name="`userend`"/>
>>> </property>
>>> <property name="userStart" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="date">
>>> <column not-null="false" unique="false" name="`userstart`"/>
>>> </property>
>>> </class>
>>>
>>> I cannot see what is missing?
>>>
>>> David
>>>
>>
>>
Re: [Teneo] Missed something in generation? [message #424495 is a reply to message #424494] Tue, 28 October 2008 14:40 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi David,
In ecore does the ECLass User have a implementation interface/class defined?

gr. Martin

David Wynter wrote:
> Hi,
>
> HEre is the actual stack trace in case that gives you some hints.
>
> org.hibernate.MappingException: Unknown entity:
> com.stpware.secmsecurity.User
> at
> org.hibernate.impl.SessionFactoryImpl.getEntityPersister(Ses sionFactoryImpl.java:580)
>
> at
> org.hibernate.event.def.DefaultLoadEventListener.onLoad(Defa ultLoadEventListener.java:91)
>
> at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905 )
> at org.hibernate.impl.SessionImpl.load(SessionImpl.java:822)
> at org.hibernate.impl.SessionImpl.load(SessionImpl.java:815)
> 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
> org.hibernate.context.ThreadLocalSessionContext$TransactionP rotectionWrapper.invoke(ThreadLocalSessionContext.java:342)
>
> at $Proxy0.load(Unknown Source)
> at
> com.stpware.secmsecurity.manager.HibernateUtil.main(Hibernat eUtil.java:115)
>
> David
>
> David Wynter wrote:
>> Hi Martin,
>>
>> ALSO_MAP_AS_CLASS has always been false, changing it to true I get the
>> same exception.
>>
>> Rgds,
>>
>> David
>> Martin Taal wrote:
>>> Hi David,
>>> And if you set this property to:
>>> props.setProperty(PersistenceOptions.ALSO_MAP_AS_CLASS,
>>> "false");
>>> true?
>>>
>>> Is there a specific reason why you have it on false?
>>>
>>> gr. Martin
>>>
>>> David Wynter wrote:
>>>> Hi,
>>>>
>>>> I cannot see what has changed, but the code that once worked no
>>>> longer works.
>>>>
>>>> From my previous example of User many to many to Role I made the
>>>> changes to the annotation to use ecore:reference, ecore:opposite and
>>>> @ManyToMany. I then reload... to genmodel, then right clicked the
>>>> ..genmodel and generated Model code, then copied the ecore file to
>>>> the bin directory. Then I ran this.
>>>>
>>>> // create the DataStore
>>>> dataStore = HbHelper.INSTANCE.createRegisterDataStore(HBNAME);
>>>> // set persistence options
>>>> Properties props = new Properties();
>>>>
>>>> props.setProperty(PersistenceOptions.MAXIMUM_SQL_NAME_LENGTH , "30");
>>>>
>>>> props.setProperty(PersistenceOptions.ID_FEATURE_AS_PRIMARY_K EY,
>>>> "true");
>>>>
>>>> props.setProperty(PersistenceOptions.DEFAULT_ID_FEATURE_NAME , "id");
>>>>
>>>> props.setProperty(PersistenceOptions.JOIN_COLUMN_NAMING_STRA TEGY,
>>>> "simple");
>>>>
>>>> //props.setProperty(PersistenceOptions.JOIN_TABLE_FOR_NON_CO NTAINED_ASSOCIATIONS,
>>>> "false");
>>>> props.setProperty(PersistenceOptions.ALSO_MAP_AS_CLASS,
>>>> "false");
>>>>
>>>> props.setProperty(PersistenceOptions.DEFAULT_TEMPORAL_VALUE, "DATE");
>>>>
>>>> props.setProperty(PersistenceOptions.DISABLE_ECONTAINER_MAPP ING,
>>>> "true");
>>>> props.setProperty(PersistenceOptions.ALWAYS_VERSION,
>>>> "false");
>>>>
>>>> props.setProperty(PersistenceOptions.ALWAYS_MAP_LIST_AS_BAG, "true");
>>>>
>>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>>> "JOINED"); // configure the EPackages used by this dataStore
>>>> dataStore.setEPackages(new EPackage[] {
>>>> secmsecurityPackage.eINSTANCE });
>>>> // load hibernate properties
>>>> try
>>>> {
>>>>
>>>> props.load(HibernateUtil.class.getResourceAsStream(HBPROPERT IES));
>>>> props.setProperty("hibernate.hbm2ddl.auto",
>>>> shouldInit ? "update" : "validate"); // create/validate/update
>>>> }
>>>> catch (Throwable t)
>>>> {
>>>> // log the exception, as it might be swallowed
>>>> System.err.println("Initial SessionFactory creation failed." + t);
>>>> throw new ExceptionInInitializerError(t);
>>>> }
>>>> dataStore.setProperties(props);
>>>> if (shouldInit)
>>>> {
>>>> // initialise the datastore
>>>> dataStore.initialize();
>>>> }
>>>> // get the session factory from the teneo hibernate datastore
>>>> sessionFactory = dataStore.getSessionFactory();
>>>> Session sess = sessionFactory.getCurrentSession();
>>>> Transaction tx = sess.beginTransaction();
>>>>
>>>> try
>>>> {
>>>> User user = (User) sess.load(User.class, new Integer(1));
>>>> ....
>>>>
>>>> I get a org.hibernate.MappingException: Unknown entity:
>>>> com.stpware.secmsecurity.User
>>>>
>>>> I check the path and the generated in memory hibernate.hbm.xml in
>>>> the build log for Teneo, the class is there.
>>>>
>>>> here is the in memory User object from the Teneo build log
>>>>
>>>> <class entity-name="User" abstract="false" lazy="false"
>>>> table="`user`">
>>>> <meta attribute="eclassName">User</meta>
>>>> <meta
>>>> attribute="epackage">http://www.stpware.com/secmsecurity</meta>
>>>> <id name="id" type="int" unsaved-value="0">
>>>> <column not-null="true" unique="false" name="`id`"/>
>>>> <generator class="identity"/>
>>>> </id>
>>>> <bag name="userPref" lazy="true" cascade="all,delete-orphan">
>>>> <key update="true" foreign-key="user_userpref">
>>>> <column name="`user`" not-null="false" unique="false"/>
>>>> </key>
>>>> <one-to-many entity-name="UserPref"/>
>>>> </bag>
>>>> <bag name="userGroup" lazy="true" inverse="true"
>>>> table="`usergroup`">
>>>> <key update="true">
>>>> <column name="`user`" not-null="true" unique="false"/>
>>>> </key>
>>>> <many-to-many entity-name="Group" unique="false"
>>>> foreign-key="user_usergroup">
>>>> <column name="`group`" not-null="true" unique="false"/>
>>>> </many-to-many>
>>>> </bag>
>>>> <bag name="userRole" lazy="true" inverse="true"
>>>> table="`userrole`">
>>>> <key update="true">
>>>> <column name="`user`" not-null="true" unique="false"/>
>>>> </key>
>>>> <many-to-many entity-name="Role" unique="false"
>>>> foreign-key="user_userrole">
>>>> <column name="`role`" not-null="true" unique="false"/>
>>>> </many-to-many>
>>>> </bag>
>>>> <property name="email" lazy="false" insert="true"
>>>> update="true" not-null="false" unique="false" type="java.lang.String">
>>>> <column not-null="false" unique="false" name="`email`"/>
>>>> </property>
>>>> <property name="firstName" lazy="false" insert="true"
>>>> update="true" not-null="false" unique="false" type="java.lang.String">
>>>> <column not-null="false" unique="false"
>>>> name="`firstname`"/>
>>>> </property>
>>>> <property name="lastLogin" lazy="false" insert="true"
>>>> update="true" not-null="false" unique="false" type="date">
>>>> <column not-null="false" unique="false"
>>>> name="`lastlogin`"/>
>>>> </property>
>>>> <property name="loginName" lazy="false" insert="true"
>>>> update="true" not-null="false" unique="false" type="java.lang.String">
>>>> <column not-null="false" unique="false"
>>>> name="`loginname`"/>
>>>> </property>
>>>> <property name="password" lazy="false" insert="true"
>>>> update="true" not-null="false" unique="false" type="java.lang.String">
>>>> <column not-null="false" unique="false" name="`password`"/>
>>>> </property>
>>>> <property name="phone" lazy="false" insert="true"
>>>> update="true" not-null="false" unique="false" type="java.lang.String">
>>>> <column not-null="false" unique="false" name="`phone`"/>
>>>> </property>
>>>> <property name="salutation" lazy="false" insert="true"
>>>> update="true" not-null="false" unique="false" type="java.lang.String">
>>>> <column not-null="false" unique="false"
>>>> name="`salutation`"/>
>>>> </property>
>>>> <property name="surname" lazy="false" insert="true"
>>>> update="true" not-null="false" unique="false" type="java.lang.String">
>>>> <column not-null="false" unique="false" name="`surname`"/>
>>>> </property>
>>>> <property name="userEnd" lazy="false" insert="true"
>>>> update="true" not-null="false" unique="false" type="date">
>>>> <column not-null="false" unique="false" name="`userend`"/>
>>>> </property>
>>>> <property name="userStart" lazy="false" insert="true"
>>>> update="true" not-null="false" unique="false" type="date">
>>>> <column not-null="false" unique="false"
>>>> name="`userstart`"/>
>>>> </property>
>>>> </class>
>>>>
>>>> I cannot see what is missing?
>>>>
>>>> David
>>>>
>>>
>>>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] Missed something in generation? [message #424496 is a reply to message #424495] Tue, 28 October 2008 14:54 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Hi,

Yes it does as below

<eClassifiers xsi:type="ecore:EClass" name="User">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="&#xD;&#xA;
&lt;xsd:p>The basic user entity. Role is a one to many, many to one
association&lt;/xsd:p>&#xD;&#xA; "/>
</eAnnotations>
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="User"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="userPref"
upperBound="-1"
eType="#//UserPref" containment="true" resolveProxies="false"
eOpposite="#//UserPref/user">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="userPref"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="userGroup"
upperBound="-1"
eType="#//Group" eOpposite="#//Group/groupUser">
<eAnnotations source="teneo.jpa">
<details key="appinfo" value=" @ManyToMany(indexed=false)
@JoinTable(name=&quot;UserGroup&quot;)"/>
</eAnnotations>
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="userGroup"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="userRole"
upperBound="-1"
eType="#//Role" eOpposite="#//Role/roleUser">
<eAnnotations source="teneo.jpa">
<details key="appinfo" value=" @ManyToMany(indexed=false)
@JoinTable(name=&quot;UserRole&quot;)"/>
</eAnnotations>
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="userRole"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="email"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="email"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="firstName"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="firstName"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Int"
unsettable="true">
<eAnnotations source="teneo.jpa">
<details key="appinfo" value="@Id
@GeneratedValue(strategy=IDENTITY)"/>
</eAnnotations>
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="id"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="lastLogin"
eType="#//JavaDate">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="lastLogin"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="loginName"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="loginName"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="password"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="password"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="phone"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="phone"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="salutation"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="salutation"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="surname"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="surname"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="userEnd"
eType="#//JavaDate">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="userEnd"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="userStart"
eType="#//JavaDate">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="attribute"/>
<details key="name" value="userStart"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>

David

Martin Taal wrote:
> Hi David,
> In ecore does the ECLass User have a implementation interface/class
> defined?
>
> gr. Martin
>
Re: [Teneo] Missed something in generation? [message #424497 is a reply to message #424496] Tue, 28 October 2008 14:59 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi David,
Sorry, I mean instanceTypeName, it doesn't. Can you check (to rule out this case) what instance is
instantiated for the EClass User?
Also if you have ALSO_MAP_AS_CLASS on true, can you check the hibernate mapping to see if the class
tag in hbm has the classname as an attribute?

gr. Martin

David Wynter wrote:
> Hi,
>
> Yes it does as below
>
> <eClassifiers xsi:type="ecore:EClass" name="User">
> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
> <details key="documentation" value="&#xD;&#xA; &lt;xsd:p>The basic
> user entity. Role is a one to many, many to one
> association&lt;/xsd:p>&#xD;&#xA; "/>
> </eAnnotations>
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="User"/>
> <details key="kind" value="elementOnly"/>
> </eAnnotations>
> <eStructuralFeatures xsi:type="ecore:EReference" name="userPref"
> upperBound="-1"
> eType="#//UserPref" containment="true" resolveProxies="false"
> eOpposite="#//UserPref/user">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> <details key="name" value="userPref"/>
> <details key="namespace" value="##targetNamespace"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EReference" name="userGroup"
> upperBound="-1"
> eType="#//Group" eOpposite="#//Group/groupUser">
> <eAnnotations source="teneo.jpa">
> <details key="appinfo" value=" @ManyToMany(indexed=false)
> @JoinTable(name=&quot;UserGroup&quot;)"/>
> </eAnnotations>
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> <details key="name" value="userGroup"/>
> <details key="namespace" value="##targetNamespace"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EReference" name="userRole"
> upperBound="-1"
> eType="#//Role" eOpposite="#//Role/roleUser">
> <eAnnotations source="teneo.jpa">
> <details key="appinfo" value=" @ManyToMany(indexed=false)
> @JoinTable(name=&quot;UserRole&quot;)"/>
> </eAnnotations>
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> <details key="name" value="userRole"/>
> <details key="namespace" value="##targetNamespace"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="email"
> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="email"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="firstName"
> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="firstName"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Int"
> unsettable="true">
> <eAnnotations source="teneo.jpa">
> <details key="appinfo" value="@Id
> @GeneratedValue(strategy=IDENTITY)"/>
> </eAnnotations>
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="id"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="lastLogin"
> eType="#//JavaDate">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="lastLogin"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="loginName"
> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="loginName"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="password"
> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="password"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="phone"
> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="phone"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="salutation"
> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="salutation"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="surname"
> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="surname"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="userEnd"
> eType="#//JavaDate">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="userEnd"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="userStart"
> eType="#//JavaDate">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="attribute"/>
> <details key="name" value="userStart"/>
> </eAnnotations>
> </eStructuralFeatures>
> </eClassifiers>
>
> David
>
> Martin Taal wrote:
>> Hi David,
>> In ecore does the ECLass User have a implementation interface/class
>> defined?
>>
>> gr. Martin
>>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] Missed something in generation? [message #424529 is a reply to message #424497] Wed, 29 October 2008 13:47 Go to previous message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Hi,

If someone reads this thread to conclusion, here it is. I had changed
the query that tests the many to many relationship I had added here. I
had used the class name fully qualified rather than the undecorated
classname which Hibernate session.load method requires.

Thx to Martin for pointing this out.

David



Martin Taal wrote:
> Hi David,
> Sorry, I mean instanceTypeName, it doesn't. Can you check (to rule out
> this case) what instance is instantiated for the EClass User?
> Also if you have ALSO_MAP_AS_CLASS on true, can you check the hibernate
> mapping to see if the class tag in hbm has the classname as an attribute?
>
> gr. Martin
>
> David Wynter wrote:
>> Hi,
>>
>> Yes it does as below
>>
>> <eClassifiers xsi:type="ecore:EClass" name="User">
>> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
>> <details key="documentation" value="&#xD;&#xA; &lt;xsd:p>The
>> basic user entity. Role is a one to many, many to one
>> association&lt;/xsd:p>&#xD;&#xA; "/>
>> </eAnnotations>
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="name" value="User"/>
>> <details key="kind" value="elementOnly"/>
>> </eAnnotations>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="userPref"
>> upperBound="-1"
>> eType="#//UserPref" containment="true" resolveProxies="false"
>> eOpposite="#//UserPref/user">
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="element"/>
>> <details key="name" value="userPref"/>
>> <details key="namespace" value="##targetNamespace"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="userGroup"
>> upperBound="-1"
>> eType="#//Group" eOpposite="#//Group/groupUser">
>> <eAnnotations source="teneo.jpa">
>> <details key="appinfo" value=" @ManyToMany(indexed=false)
>> @JoinTable(name=&quot;UserGroup&quot;)"/>
>> </eAnnotations>
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="element"/>
>> <details key="name" value="userGroup"/>
>> <details key="namespace" value="##targetNamespace"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="userRole"
>> upperBound="-1"
>> eType="#//Role" eOpposite="#//Role/roleUser">
>> <eAnnotations source="teneo.jpa">
>> <details key="appinfo" value=" @ManyToMany(indexed=false)
>> @JoinTable(name=&quot;UserRole&quot;)"/>
>> </eAnnotations>
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="element"/>
>> <details key="name" value="userRole"/>
>> <details key="namespace" value="##targetNamespace"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="email"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="attribute"/>
>> <details key="name" value="email"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="firstName"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="attribute"/>
>> <details key="name" value="firstName"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Int"
>> unsettable="true">
>> <eAnnotations source="teneo.jpa">
>> <details key="appinfo" value="@Id
>> @GeneratedValue(strategy=IDENTITY)"/>
>> </eAnnotations>
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="attribute"/>
>> <details key="name" value="id"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="lastLogin"
>> eType="#//JavaDate">
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="attribute"/>
>> <details key="name" value="lastLogin"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="loginName"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="attribute"/>
>> <details key="name" value="loginName"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="password"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="attribute"/>
>> <details key="name" value="password"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="phone"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="attribute"/>
>> <details key="name" value="phone"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="salutation"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="attribute"/>
>> <details key="name" value="salutation"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="surname"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String">
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="attribute"/>
>> <details key="name" value="surname"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="userEnd"
>> eType="#//JavaDate">
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="attribute"/>
>> <details key="name" value="userEnd"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="userStart"
>> eType="#//JavaDate">
>> <eAnnotations
>> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
>> <details key="kind" value="attribute"/>
>> <details key="name" value="userStart"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> </eClassifiers>
>>
>> David
>>
>> Martin Taal wrote:
>>> Hi David,
>>> In ecore does the ECLass User have a implementation interface/class
>>> defined?
>>>
>>> gr. Martin
>>>
>>
>
>
Previous Topic:Teneo Tutorial1 Not Creating All Tables
Next Topic:Re: Importing Rose Model with OCL Constraints?
Goto Forum:
  


Current Time: Fri Apr 26 03:43:58 GMT 2024

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

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

Back to the top