Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327551 - Failure to map tables
Summary: Failure to map tables
Status: RESOLVED WORKSFORME
Alias: None
Product: EMF
Classification: Modeling
Component: Teneo (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Martin Taal CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-12 08:47 EDT by tenor CLA
Modified: 2010-10-15 11:12 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 tenor CLA 2010-10-12 08:47:59 EDT
Build Identifier: 

12-Oct-2010 13:29:30 org.eclipse.emf.teneo.hibernate.HbHelper createRegisterDataStore
INFO: Creating emf data store and registering it under name: MyDb
Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/EntityNameResolver
	at org.eclipse.emf.teneo.hibernate.HbHelper$1.createHbDataStore(HbHelper.java:60)
	at org.eclipse.emf.teneo.hibernate.HbHelper.createRegisterDataStore(HbHelper.java:162)
	at teneotest.EmfTeneoHibernate.main(EmfTeneoHibernate.java:22)
Caused by: java.lang.ClassNotFoundException: org.hibernate.EntityNameResolver
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	... 3 more


I am trying this example ie

http://www.rcp-vision.com/index.php?option=com_content&view=article&id=76%3Aeclipse-rcp-how-to-create-and-persist-an-emf-model&catid=40%3Atutorialeclipse&Itemid=28&lang=en



Reproducible: Always

Steps to Reproduce:
1.Just run the example as suggested.
2.
3.
Comment 1 Martin Taal CLA 2010-10-12 08:50:03 EDT
Hi,
Which version of Hibernate are you using?

gr. Martin
Comment 2 tenor CLA 2010-10-12 09:04:55 EDT
hibernate3.jar, as suggested in the link.And i am using only this project.
But i notice that 

http://www.rcp-vision.com/index.php?option=com_content&view=article&id=76%3Aeclipse-rcp-how-to-create-and-persist-an-emf-model&catid=40%3Atutorialeclipse&Itemid=28&lang=en


But in my Plug-in Dependencies it is this one, ie 

C:\onesatplan\eclipse\3.6.0\eclipse\plugins\org.eclipse.emf.teneo.hibernate_1.1.2.v201006151458.jar


Do i NEED 

org.eclipse.emf.teneo.hibernate_1.1.1.v200908231630

if so, where i can have the jar as in the attachment, there is only the zip of this.

Much Thanks.
Comment 3 Martin Taal CLA 2010-10-12 09:32:42 EDT
If you open the hibernate3.jar you can find version information in the META-INF directory I think.

My feel is that you use a hibernate version which is incompatible with the version of Teneo.

This is a more up-to-date resource on how to install EMF/Teneo:
http://wiki.eclipse.org/Teneo/Hibernate/Download_and_Install

gr. Martin
Comment 4 tenor CLA 2010-10-12 12:51:48 EDT
hibernate3.jar, as suggested in the link.And i am using only this project.
But i notice that 

http://www.rcp-vision.com/index.php?option=com_content&view=article&id=76%3Aeclipse-rcp-how-to-create-and-persist-an-emf-model&catid=40%3Atutorialeclipse&Itemid=28&lang=en


But in my Plug-in Dependencies it is this one, ie 

C:\onesatplan\eclipse\3.6.0\eclipse\plugins\org.eclipse.emf.teneo.hibernate_1.1.2.v201006151458.jar


Do i NEED 

org.eclipse.emf.teneo.hibernate_1.1.1.v200908231630

if so, where i can have the jar as in the attachment, there is only the zip of this.

Much Thanks.
Comment 5 tenor CLA 2010-10-12 12:54:19 EDT
I redid the entire thing from this

http://wiki.eclipse.org/Teneo/Hibernate/Download_and_Install

but as mentioned in 

http://www.rcp-vision.com/index.php?option=com_content&view=article&id=76%3Aeclipse-rcp-how-to-create-and-persist-an-emf-model&catid=40%3Atutorialeclipse&Itemid=28&lang=en


for hibernate3.jar 

I put that and i again get same error!!

If i dont have to put that jar ie hibernate3.jar 
which jar will/should support after having re done the thing from your link ie

http://wiki.eclipse.org/Teneo/Hibernate/Download_and_Install
Comment 6 Martin Taal CLA 2010-10-12 12:58:55 EDT
Hi,
Don't use your hibernate3.jar, my guess is that it is an old version of Hibernate. See my previous comment about checking the version.

Did you see the part about downloading/installing the 3rd party dependencies using an update manager:
http://wiki.eclipse.org/Teneo/Hibernate/Download_and_Install#Download_and_install_using_the_update_manager_.28for_usage_in_Eclipse.2FOSGI.29

gr. Martin
Comment 7 tenor CLA 2010-10-12 14:57:32 EDT
Yes i have followed exactly as you have sent ie for all 3.

But again, i am asking if i DONT have to use hibernate3.jar, what should support from (ie Teneo Dependency)

http://wiki.eclipse.org/Teneo/Hibernate/Download_and_Install#Download_and_install_using_the_update_manager_.28for_usage_in_Eclipse.2FOSGI.29

As hibernate from there does not automatically take care of error like

org.hibernate.session;(Eclipse marks red)

so it is still having elements mid air collision! ;-)
Comment 8 Martin Taal CLA 2010-10-12 15:56:59 EDT
Hi,
The update site on elver.org provides the hibernate plugin with the correct hibernate version. 

That's a different error, can you post/attach the complete stacktrace and code you use?

I would advice to forget about the tutorial on rcp-vision.com and follow the tutorials on the Teneo wiki, really! :-)

Follow these steps here:
http://wiki.eclipse.org/Teneo/Hibernate/Download_and_Install#Download_and_install_using_the_update_manager_.28for_usage_in_Eclipse.2FOSGI.29
and then:
http://wiki.eclipse.org/Teneo/Hibernate/QuickStart
http://wiki.eclipse.org/Teneo/Hibernate/Tutorial

gr. Martin
Comment 9 tenor CLA 2010-10-13 02:17:02 EDT
Thanks, i have yet to try the suggested links, will post if i come across difficulties there too.

I will also post the code and stacktrace of the efforts so far.

Meanwhile, i need your opinion on two things as we are in the exploring/investigating phase of prototype of project.

1) We have Eclipse RCP,EMF. Is it possible to do away with Teneo and straight away persist EMF generated our domain models with hibernate? if possible, what are pros and cons to it, if not what hinders it that way? 
Is List implementation  markedly different in Hibernate(pure) and EMF generated models? Does Teneo bridge the gap between the two world, if so, how?


2) Will it be better to use CDO, in place of Teneo and what are their individual merits and demerits in large application?

For CDO, any link you will like to suggest as you have suggested for the Teneo.

Much Thanks.
Comment 10 Martin Taal CLA 2010-10-13 05:10:30 EDT
Hi,
Yes you can persist directly to hibernate. EMF list implementations are very different from standard java.util.List, EMF adds bi-directional handling and notifications and containment handling. Teneo handles this and other EMF specialities for you. 
For more info see here:
http://wiki.eclipse.org/Teneo/Hibernate/Architecture_Overview

Using Teneo directly in a rcp gives you a 2-tier architecture. I often make the statement that Teneo is best for EMF on the server (like in web-service environments). For 3-tier RCP you should consider CDO, Teneo is available as a specific store in CDO: 
http://wiki.eclipse.org/CDO_Hibernate_Store

or the more generic CDO link:
http://wiki.eclipse.org/CDO

Teneo/CDO gives you great mapping capabilities combined with great CDO features such as client-side memory management etc. The Teneo/CDO store does however not support all CDO features, related to advanced versioning (multiple versions of an object are stored in one table), branching and offline mode. CDO/Teneo is good for standard business administration apps which don't require this mode.

Hope this helps.

gr. Martin
Comment 11 tenor CLA 2010-10-13 07:03:30 EDT
Stack Trace:--

13-Oct-2010 11:59:19 org.eclipse.emf.teneo.hibernate.HbHelper createRegisterDataStore
INFO: Creating emf data store and registering it under name: MyDb
Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/EntityNameResolver
	at org.eclipse.emf.teneo.hibernate.HbHelper$1.createHbDataStore(HbHelper.java:60)
	at org.eclipse.emf.teneo.hibernate.HbHelper.createRegisterDataStore(HbHelper.java:162)
	at teneotest.EmfTeneoHibernate.main(EmfTeneoHibernate.java:22)
Caused by: java.lang.ClassNotFoundException: org.hibernate.EntityNameResolver
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	... 3 more


though i have put now hibernate-entitymanager-3.3.2.GA.jar, instead of hibernate3.jar.

Code is exactly as is in the link

http://www.rcp-vision.com/index.php?option=com_content&view=article&id=76%3Aeclipse-rcp-how-to-create-and-persist-an-emf-model&catid=40%3Atutorialeclipse&Itemid=28&lang=en

-----------------------------------------------------------------------------

Part B)

which exact link i have to dowload from ie any SVN one ? or directly off the net as not making sense from the following ie


The example project (org.eclipse.emf.teneo.hibernate.examples) can be found on this cvs location: 

dev.eclipse.org 
/cvsroot/modeling 
org.eclipse.emf/org.eclipse.emf.teneo/examples 
The main examples project used in the tutorials is the: org.eclipse.emf.teneo.hibernate.examples project. 


from the link

http://wiki.eclipse.org/Teneo/Hibernate/Download_and_Install#Download_and_install_using_the_update_manager_.28for_usage_in_Eclipse.2FOSGI.29


Much Thanks.
Comment 12 Martin Taal CLA 2010-10-13 07:19:51 EDT
Hi,
This issue is because you use a version of hibernate3.jar which does not match with Teneo's. Adding the hibernate entity manager won't help all. You need to use hibernate 3.3.2 or later. Please make sure that the hibernate3.jar is from a recent hibernate download!

I did not make the rcp-vision tutorial, it uses an outdated way of including the teneo dependencies, the teneo dependencies can be installed as plugins. Just as it is explained in the download and install pages on the wiki.

See this page:
http://wiki.eclipse.org/Teneo/Hibernate

read the top section and specifically this line:
Note: the difference in hibernate versions between the 1.1.0 and 1.1.1 and higher builds. Hibernate introduced a binary incompatibility in version 3.3.2, forcing Teneo to adhere to this.

This binary incompatibility is exactly what you are encountering here.

B) this link is to a cvs location not a svn location. I don't understand your problem, the properties listed there make perfect sense when you download from a cvs location....

gr. Martin
Comment 13 tenor CLA 2010-10-13 09:24:30 EDT
Stack Trace:--

13-Oct-2010 11:59:19 org.eclipse.emf.teneo.hibernate.HbHelper createRegisterDataStore
INFO: Creating emf data store and registering it under name: MyDb
Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/EntityNameResolver
	at org.eclipse.emf.teneo.hibernate.HbHelper$1.createHbDataStore(HbHelper.java:60)
	at org.eclipse.emf.teneo.hibernate.HbHelper.createRegisterDataStore(HbHelper.java:162)
	at teneotest.EmfTeneoHibernate.main(EmfTeneoHibernate.java:22)
Caused by: java.lang.ClassNotFoundException: org.hibernate.EntityNameResolver
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	... 3 more


though i have put now hibernate-entitymanager-3.3.2.GA.jar, instead of hibernate3.jar.

Code is exactly as is in the link

http://www.rcp-vision.com/index.php?option=com_content&view=article&id=76%3Aeclipse-rcp-how-to-create-and-persist-an-emf-model&catid=40%3Atutorialeclipse&Itemid=28&lang=en

-----------------------------------------------------------------------------

Part B)

which exact link i have to dowload from ie any SVN one ? or directly off the net as not making sense from the following ie


The example project (org.eclipse.emf.teneo.hibernate.examples) can be found on this cvs location: 

dev.eclipse.org 
/cvsroot/modeling 
org.eclipse.emf/org.eclipse.emf.teneo/examples 
The main examples project used in the tutorials is the: org.eclipse.emf.teneo.hibernate.examples project. 


from the link

http://wiki.eclipse.org/Teneo/Hibernate/Download_and_Install#Download_and_install_using_the_update_manager_.28for_usage_in_Eclipse.2FOSGI.29


Much Thanks.
Comment 14 tenor CLA 2010-10-13 09:28:50 EDT
log4j:WARN No appenders could be found for logger (org.eclipse.emf.teneo.hibernate.HbHelper).
log4j:WARN Please initialize the log4j system properly.
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: insert into "customer" (e_version, "code", "name", dtype, e_id) values (?, ?, ?, 'Customer', ?)
The customer details are :-- 0023485

Thanks it works after 1.5 days of struggle. :-) 

Mid Air Collision averted. 

But perhaps briefly seen, these two ie 

import org.eclipse.emf.teneo.hibernate.HbDataStore;
import org.eclipse.emf.teneo.hibernate.HbHelper;

are doing the magic. which is meta xml file where rich support for Lazy loading and tuplizing was ensured?

And problem with CVS is, i donot know 
what to enter in 

Location:
Host

Authentication:

User
password
Repository path


Much Thanks.
Comment 15 Martin Taal CLA 2010-10-13 09:37:23 EDT
Hi,
You can see the generated hibernate mapping file by doing dataStore.getMappingXml().

for cvs:
host: dev.eclipse.org 
location: /cvsroot/modeling 
Repository path: org.eclipse.emf/org.eclipse.emf.teneo/examples 
user: anonymous
password: anonymous (or nothing)

gr. Martin
Comment 16 tenor CLA 2010-10-13 10:55:24 EDT
log4j:WARN No appenders could be found for logger (org.eclipse.emf.teneo.hibernate.HbHelper).
log4j:WARN Please initialize the log4j system properly.
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: insert into "customer" (e_version, "code", "name", dtype, e_id) values (?, ?, ?, 'Customer', ?)
The customer details are :-- 0023485

Thanks it works after 1.5 days of struggle. :-) 

Mid Air Collision averted. 

But perhaps briefly seen, these two ie 

import org.eclipse.emf.teneo.hibernate.HbDataStore;
import org.eclipse.emf.teneo.hibernate.HbHelper;

are doing the magic. which is meta xml file where rich support for Lazy loading and tuplizing was ensured?

And problem with CVS is, i donot know 
what to enter in 

Location:
Host

Authentication:

User
password
Repository path


Much Thanks.
Comment 17 tenor CLA 2010-10-13 10:58:45 EDT
Thanks now it was able to download.

I am referring to where the Teneo reads xml file, not the generated one, does it indeed have some xml file to refer to as the generated one (below) does not give much clue how teneo is processing it ?

The generated XML is : 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping auto-import="false">
	<class name="orders.impl.CustomerImpl" entity-name="Customer" abstract="false" lazy="false" discriminator-value="Customer" table="`customer`">
		<meta attribute="eclassName" inherit="false">Customer</meta>
		<meta attribute="epackage" inherit="false">http://orders</meta>
		<id type="long" name="e_id" column="e_id" access="org.eclipse.emf.teneo.hibernate.mapping.identifier.IdentifierPropertyHandler">
			<meta attribute="syntheticId" inherit="false">true</meta>
			<generator class="native"/>
		</id>
		<discriminator type="string">
			<column name="dtype" index="customerdtype" length="255" not-null="true"/>
		</discriminator>
		<version name="e_version" column="e_version" access="org.eclipse.emf.teneo.hibernate.mapping.property.VersionPropertyHandler">
			<meta attribute="syntheticVersion" inherit="false">true</meta>
		</version>
		<property name="code" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
			<column not-null="false" unique="false" name="`code`"/>
		</property>
		<property name="name" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
			<column not-null="false" unique="false" name="`name`"/>
		</property>
	</class>
</hibernate-mapping>
Comment 18 Martin Taal CLA 2010-10-13 11:08:34 EDT
It is done inside in the HbSessionDataStore and HbEntityDataStore classes, the xml is passed to the hibernate configuration object.

gr. Martin
Comment 19 tenor CLA 2010-10-13 11:51:25 EDT
Thanks now it was able to download.

I am referring to where the Teneo reads xml file, not the generated one, does it indeed have some xml file to refer to as the generated one (below) does not give much clue how teneo is processing it ?

The generated XML is : 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping auto-import="false">
	<class name="orders.impl.CustomerImpl" entity-name="Customer" abstract="false" lazy="false" discriminator-value="Customer" table="`customer`">
		<meta attribute="eclassName" inherit="false">Customer</meta>
		<meta attribute="epackage" inherit="false">http://orders</meta>
		<id type="long" name="e_id" column="e_id" access="org.eclipse.emf.teneo.hibernate.mapping.identifier.IdentifierPropertyHandler">
			<meta attribute="syntheticId" inherit="false">true</meta>
			<generator class="native"/>
		</id>
		<discriminator type="string">
			<column name="dtype" index="customerdtype" length="255" not-null="true"/>
		</discriminator>
		<version name="e_version" column="e_version" access="org.eclipse.emf.teneo.hibernate.mapping.property.VersionPropertyHandler">
			<meta attribute="syntheticVersion" inherit="false">true</meta>
		</version>
		<property name="code" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
			<column not-null="false" unique="false" name="`code`"/>
		</property>
		<property name="name" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
			<column not-null="false" unique="false" name="`name`"/>
		</property>
	</class>
</hibernate-mapping>
Comment 20 tenor CLA 2010-10-14 07:24:54 EDT
I cvs checked out and in eclipse it appears as this
>examples [dev.eclipse.org]

and i am at this

     ----org.eclipse.emf.teneo.hibernate.examples

Trying for example 
public class QuickStart 

But it says not on buildpath, how to put it on that, as i donot find a way.


B)

I have EMF model, for teneo to kick in, all i have to just as in QuickStart ie one main file required.
Comment 21 Martin Taal CLA 2010-10-14 08:06:26 EDT
Hi,
I am not sure what goes wrong with the example project, did you do 'check out as' or just 'check out', if the latter then normally the java project should be created correctly. 

Can you check that the examples project is indeed a java project?

gr. Martin
Comment 22 tenor CLA 2010-10-14 09:28:59 EDT
I cvs checked out and in eclipse it appears as this
>examples [dev.eclipse.org]

and i am at this

     ----org.eclipse.emf.teneo.hibernate.examples

Trying for example 
public class QuickStart 

But it says not on buildpath, how to put it on that, as i donot find a way.


B)

I have EMF model, for teneo to kick in, all i have to just as in QuickStart ie one main file required.
Comment 23 tenor CLA 2010-10-14 10:07:30 EDT
I am redoing the checking out.

After the default checkout step, there is select a tag option with the following 

HEAD
Branches
Versions
Dates

which one i should choose,earlier i had chosen HEAD.

Thanks.
Comment 24 tenor CLA 2010-10-14 10:16:37 EDT
I am redoing the checking out.

After the default checkout step, there is select a tag option with the following 

HEAD
Branches
Versions
Dates

which one i should choose,earlier i had chosen HEAD.

Thanks.
Comment 25 Martin Taal CLA 2010-10-14 11:23:44 EDT
HEAD
Comment 26 tenor CLA 2010-10-14 12:11:52 EDT
Earlier i had chosen for HEAD, sorry i chose for Branch as awaiting reply still it is downloading !should i cancel.

Branches are hazardous?

The example which i ran had this flow(from rcp vision)

EMF --> Teneo --> Persist

And one example 
EMF models themselves had Teneo stuff ie models with some Teneo stuff, who is generating it in this manner or i might have got it completely wrong!

Thanks.
Comment 27 Martin Taal CLA 2010-10-14 12:29:08 EDT
It is better to take Head, but the download can't take long as it is a small project.

Just follow the tutorials on wiki.eclipse.org, I did not do the rcp tutorial so I can't take responsibility for that.

gr. Martin
Comment 28 tenor CLA 2010-10-15 09:46:51 EDT
Network Protocol Features 
Net4j based binary application protocol 
Pluggable transport layer (shipped with NIO socket transport, polling HTTP and JVM embedded transport) 
Pluggable fail over support 
Pluggable authentication (shipped with challenge/response negotiation) 
Multiple acceptors per server 


In the link 

http://wiki.eclipse.org/CDO

We need to have low latency/high bandwidth setup, perhaps with Citrix. this kind of network features will be a bit of problem or value add ?

Thanks.
Comment 29 Martin Taal CLA 2010-10-15 09:48:49 EDT
This is a question to ask on the EMF newsgroup. 

For all further questions, I propose to not continue in this bugzilla and continue in the EMF newsgroup.

gr. Martin
Comment 30 tenor CLA 2010-10-15 11:10:49 EDT
Network Protocol Features 
Net4j based binary application protocol 
Pluggable transport layer (shipped with NIO socket transport, polling HTTP and JVM embedded transport) 
Pluggable fail over support 
Pluggable authentication (shipped with challenge/response negotiation) 
Multiple acceptors per server 


In the link 

http://wiki.eclipse.org/CDO

We need to have low latency/high bandwidth setup, perhaps with Citrix. this kind of network features will be a bit of problem or value add ?

Thanks.
Comment 31 tenor CLA 2010-10-15 11:12:09 EDT
Much Thanks for the support so far.

Hope you will contiue to respond on EMF newsgroup.

Are you available anywhere else, say gmail ?

Thanks a lot.

Regards
Animesh