Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] newbee question .. MappingException: Could not determine type for:
[Teneo] newbee question .. MappingException: Could not determine type for: [message #116598] Thu, 03 April 2008 11:52 Go to next message
Eclipse UserFriend
Originally posted by: psanampu.cisco.com

hi,
I have just started with the library tutorial on elver.org. The library xsd
is attached.
I have done the following things:
1) created model and edit plugins for the library xsd
2) setup a hsql server instance , created a library db and modified the
hibernate properties accordingly.
3) I am using the versions we got from the eclipsecon2008 Teneo session in
model-driven-dev tutorial on first day.
[ except hsql related, which I took the latest from hsql.org ] .

here is the test method I am invoking from a view class of another plugin ..

public String testAddBook(){
final String dataStoreName = "LibraryDataStore";
final Session session = StoreController.getInstance().getSession();
final Transaction tx = session.getTransaction();
session.beginTransaction();
//Create and populate Library
Library library = LibraryFactory.eINSTANCE.createLibrary();
library.setName("My Library");
// Make it persistent.
session.save(library);
// Create a writer...
Writer writer = LibraryFactory.eINSTANCE.createWriter();
writer.setName("JRR Tolkien");
// ...and one of his books.
Book book = LibraryFactory.eINSTANCE.createBook();
book.setAuthor(writer);
book.setPages(305);
book.setTitle("The Hobbit");
book.setCategory(BookCategory.SCIENCE_FICTION);
// Add the Writer and Book to the Library. They are made
// persistent automatically because the Library is itself
// already persistent.
library.getWriters().add(writer);
library.getBooks().add(book);
//Commit Transaction and close Session
//The Library is not stored in the database until you commit the
Transaction:
session.getTransaction().commit();
session.close();
}

During database schema update call, I am getting the following error .

Could not determine type for:
org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book, for
columns: [org.hibernate.mapping.Column(category)]
org.hibernate.MappingException: Could not determine type for:
org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book, for
columns: [org.hibernate.mapping.Column(category)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
at org.hibernate.mapping.Property.isValid(Property.java:185)
at org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:440)
at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
at org.hibernate.cfg.Configuration.validate(Configuration.java: 1108)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1293)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:172)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:86)
at test.StoreController.initializeDataStore(StoreController.jav a:65)
at test.StoreController.getDataStore(StoreController.java:31)
at test.StoreController.getSession(StoreController.java:26)
at test.TestTeneo.testAddBook(TestTeneo.java:46)

What am I missing ?

Appreciate your help
Thanks
Prasad


  • Attachment: library.xsd
    (Size: 1.54KB, Downloaded 297 times)
Re: [Teneo] newbee question .. MappingException: Could not determine type for: [message #116703 is a reply to message #116598] Thu, 03 April 2008 12:00 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Prasad,
How does the StoreController initialize the Teneo datastore, can you post that part of the code?

gr. Martin

prasad wrote:
> hi,
> I have just started with the library tutorial on elver.org. The library xsd
> is attached.
> I have done the following things:
> 1) created model and edit plugins for the library xsd
> 2) setup a hsql server instance , created a library db and modified the
> hibernate properties accordingly.
> 3) I am using the versions we got from the eclipsecon2008 Teneo session in
> model-driven-dev tutorial on first day.
> [ except hsql related, which I took the latest from hsql.org ] .
>
> here is the test method I am invoking from a view class of another plugin ..
>
> public String testAddBook(){
> final String dataStoreName = "LibraryDataStore";
> final Session session = StoreController.getInstance().getSession();
> final Transaction tx = session.getTransaction();
> session.beginTransaction();
> //Create and populate Library
> Library library = LibraryFactory.eINSTANCE.createLibrary();
> library.setName("My Library");
> // Make it persistent.
> session.save(library);
> // Create a writer...
> Writer writer = LibraryFactory.eINSTANCE.createWriter();
> writer.setName("JRR Tolkien");
> // ...and one of his books.
> Book book = LibraryFactory.eINSTANCE.createBook();
> book.setAuthor(writer);
> book.setPages(305);
> book.setTitle("The Hobbit");
> book.setCategory(BookCategory.SCIENCE_FICTION);
> // Add the Writer and Book to the Library. They are made
> // persistent automatically because the Library is itself
> // already persistent.
> library.getWriters().add(writer);
> library.getBooks().add(book);
> //Commit Transaction and close Session
> //The Library is not stored in the database until you commit the
> Transaction:
> session.getTransaction().commit();
> session.close();
> }
>
> During database schema update call, I am getting the following error .
>
> Could not determine type for:
> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book, for
> columns: [org.hibernate.mapping.Column(category)]
> org.hibernate.MappingException: Could not determine type for:
> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book, for
> columns: [org.hibernate.mapping.Column(category)]
> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
> at org.hibernate.mapping.Property.isValid(Property.java:185)
> at org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:440)
> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1108)
> at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1293)
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:172)
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:86)
> at test.StoreController.initializeDataStore(StoreController.jav a:65)
> at test.StoreController.getDataStore(StoreController.java:31)
> at test.StoreController.getSession(StoreController.java:26)
> at test.TestTeneo.testAddBook(TestTeneo.java:46)
>
> What am I missing ?
>
> Appreciate your help
> Thanks
> Prasad
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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] newbee question .. MappingException: Could not determine type for: [message #116715 is a reply to message #116703] Thu, 03 April 2008 12:15 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Prasad,
This could also be a class-loading/plugin dependency issue (that hibernate can not see the teneo
hibernate.mapper classes).

Can you let me know how you setup the hibernate libraries? Did you put them in a separate plugin
with Eclipse-Buddypolicy: dependent in the manifest.mf?

gr. Martin

Martin Taal wrote:
> Hi Prasad,
> How does the StoreController initialize the Teneo datastore, can you
> post that part of the code?
>
> gr. Martin
>
> prasad wrote:
>> hi,
>> I have just started with the library tutorial on elver.org. The
>> library xsd is attached.
>> I have done the following things:
>> 1) created model and edit plugins for the library xsd
>> 2) setup a hsql server instance , created a library db and modified
>> the hibernate properties accordingly.
>> 3) I am using the versions we got from the eclipsecon2008 Teneo
>> session in model-driven-dev tutorial on first day.
>> [ except hsql related, which I took the latest from hsql.org ] .
>>
>> here is the test method I am invoking from a view class of another
>> plugin ..
>>
>> public String testAddBook(){
>> final String dataStoreName = "LibraryDataStore";
>> final Session session = StoreController.getInstance().getSession();
>> final Transaction tx = session.getTransaction();
>> session.beginTransaction();
>> //Create and populate Library
>> Library library = LibraryFactory.eINSTANCE.createLibrary();
>> library.setName("My Library");
>> // Make it persistent.
>> session.save(library);
>> // Create a writer...
>> Writer writer = LibraryFactory.eINSTANCE.createWriter();
>> writer.setName("JRR Tolkien");
>> // ...and one of his books.
>> Book book = LibraryFactory.eINSTANCE.createBook();
>> book.setAuthor(writer);
>> book.setPages(305);
>> book.setTitle("The Hobbit");
>> book.setCategory(BookCategory.SCIENCE_FICTION);
>> // Add the Writer and Book to the Library. They are made
>> // persistent automatically because the Library is itself
>> // already persistent.
>> library.getWriters().add(writer);
>> library.getBooks().add(book);
>> //Commit Transaction and close Session
>> //The Library is not stored in the database until you commit the
>> Transaction:
>> session.getTransaction().commit();
>> session.close();
>> }
>>
>> During database schema update call, I am getting the following error .
>>
>> Could not determine type for:
>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book,
>> for columns: [org.hibernate.mapping.Column(category)]
>> org.hibernate.MappingException: Could not determine type for:
>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book,
>> for columns: [org.hibernate.mapping.Column(category)]
>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
>> at org.hibernate.mapping.Property.isValid(Property.java:185)
>> at
>> org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:440)
>> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
>> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1108)
>> at
>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1293)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:172)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:86)
>>
>> at test.StoreController.initializeDataStore(StoreController.jav a:65)
>> at test.StoreController.getDataStore(StoreController.java:31)
>> at test.StoreController.getSession(StoreController.java:26)
>> at test.TestTeneo.testAddBook(TestTeneo.java:46)
>>
>> What am I missing ?
>>
>> Appreciate your help
>> Thanks
>> Prasad
>>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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] newbee question .. MappingException: Could not determine type for: [message #116725 is a reply to message #116703] Thu, 03 April 2008 12:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: psanampu.cisco.com

hi Martin,

here it is:

package test;


import java.io.IOException;

import java.util.Properties;


import org.eclipse.emf.common.util.URI;

import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.teneo.PersistenceOptions;

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

import org.eclipse.emf.teneo.hibernate.HbSessionDataStore;

import org.hibernate.Session;


public class StoreController {


public static final URI DATABASE_URI = URI

..createURI("hibernate://?dsname=library");


private static StoreController instance = new StoreController();


public static StoreController getInstance() {

return instance;

}


private HbSessionDataStore dataStore = null;


public Session getSession() {

return getDataStore().getSessionFactory().openSession();

}


public HbSessionDataStore getDataStore() {

if (dataStore == null) {

dataStore = initializeDataStore();

}


return dataStore;

}


public void closeDataStore() {

getDataStore().close();

}


public HbSessionDataStore initializeDataStore() {

final HbSessionDataStore localDataStore = new HbSessionDataStore();

localDataStore.setName("library");

HbHelper.INSTANCE.register(localDataStore);


final Properties props = new Properties();

try {

props

..load(this.getClass().getResourceAsStream(

"/teneo.properties"));

//props.put(PersistenceOptions.USE_MAPPING_FILE, true);

} catch (IOException e) {

throw new IllegalStateException(e);

}

localDataStore.setProperties(props);


// get the epackage nsuri

final String[] nsuris = props.getProperty("nsuri").split(",");

final EPackage[] ePackages = new EPackage[nsuris.length];

int i = 0;

for (String nsuri : nsuris) {

ePackages[i++] = EPackage.Registry.INSTANCE.getEPackage(nsuri

..trim());

}

localDataStore.setEPackages(ePackages);

localDataStore.initialize();


System.err.println(localDataStore.getMappingXML());


return localDataStore;

}

}







"Martin Taal" <mtaal@elver.org> wrote in message
news:ft2gsh$ft3$1@build.eclipse.org...
> Hi Prasad,
> How does the StoreController initialize the Teneo datastore, can you post
> that part of the code?
>
> gr. Martin
>
> prasad wrote:
>> hi,
>> I have just started with the library tutorial on elver.org. The library
>> xsd is attached.
>> I have done the following things:
>> 1) created model and edit plugins for the library xsd
>> 2) setup a hsql server instance , created a library db and modified the
>> hibernate properties accordingly.
>> 3) I am using the versions we got from the eclipsecon2008 Teneo session
>> in model-driven-dev tutorial on first day.
>> [ except hsql related, which I took the latest from hsql.org ] .
>>
>> here is the test method I am invoking from a view class of another plugin
>> ..
>>
>> public String testAddBook(){
>> final String dataStoreName = "LibraryDataStore";
>> final Session session = StoreController.getInstance().getSession();
>> final Transaction tx = session.getTransaction();
>> session.beginTransaction();
>> //Create and populate Library
>> Library library = LibraryFactory.eINSTANCE.createLibrary();
>> library.setName("My Library");
>> // Make it persistent.
>> session.save(library);
>> // Create a writer...
>> Writer writer = LibraryFactory.eINSTANCE.createWriter();
>> writer.setName("JRR Tolkien");
>> // ...and one of his books.
>> Book book = LibraryFactory.eINSTANCE.createBook();
>> book.setAuthor(writer);
>> book.setPages(305);
>> book.setTitle("The Hobbit");
>> book.setCategory(BookCategory.SCIENCE_FICTION);
>> // Add the Writer and Book to the Library. They are made
>> // persistent automatically because the Library is itself
>> // already persistent.
>> library.getWriters().add(writer);
>> library.getBooks().add(book);
>> //Commit Transaction and close Session
>> //The Library is not stored in the database until you commit the
>> Transaction:
>> session.getTransaction().commit();
>> session.close();
>> }
>>
>> During database schema update call, I am getting the following error .
>>
>> Could not determine type for:
>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book, for
>> columns: [org.hibernate.mapping.Column(category)]
>> org.hibernate.MappingException: Could not determine type for:
>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book, for
>> columns: [org.hibernate.mapping.Column(category)]
>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
>> at org.hibernate.mapping.Property.isValid(Property.java:185)
>> at
>> org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:440)
>> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
>> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1108)
>> at
>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1293)
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:172)
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:86)
>> at test.StoreController.initializeDataStore(StoreController.jav a:65)
>> at test.StoreController.getDataStore(StoreController.java:31)
>> at test.StoreController.getSession(StoreController.java:26)
>> at test.TestTeneo.testAddBook(TestTeneo.java:46)
>>
>> What am I missing ?
>>
>> Appreciate your help
>> Thanks
>> Prasad
>
>
> --
>
> With Regards, Martin Taal
>
> Springsite/Elver.org
> Office: Hardwareweg 4, 3821 BV Amersfoort
> Postal: Nassaulaan 7, 3941 EC Doorn
> The Netherlands
> 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] newbee question .. MappingException: Could not determine type for: [message #116735 is a reply to message #116715] Thu, 03 April 2008 12:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: psanampu.cisco.com

Great !! That did the trick. Sorry about missing that instruction in the
first place.


thanks
Prasad



"Martin Taal" <mtaal@elver.org> wrote in message
news:ft2hop$un$1@build.eclipse.org...
> Hi Prasad,
> This could also be a class-loading/plugin dependency issue (that hibernate
> can not see the teneo hibernate.mapper classes).
>
> Can you let me know how you setup the hibernate libraries? Did you put
> them in a separate plugin with Eclipse-Buddypolicy: dependent in the
> manifest.mf?
>
> gr. Martin
>
> Martin Taal wrote:
>> Hi Prasad,
>> How does the StoreController initialize the Teneo datastore, can you post
>> that part of the code?
>>
>> gr. Martin
>>
>> prasad wrote:
>>> hi,
>>> I have just started with the library tutorial on elver.org. The library
>>> xsd is attached.
>>> I have done the following things:
>>> 1) created model and edit plugins for the library xsd
>>> 2) setup a hsql server instance , created a library db and modified the
>>> hibernate properties accordingly.
>>> 3) I am using the versions we got from the eclipsecon2008 Teneo session
>>> in model-driven-dev tutorial on first day.
>>> [ except hsql related, which I took the latest from hsql.org ] .
>>>
>>> here is the test method I am invoking from a view class of another
>>> plugin ..
>>>
>>> public String testAddBook(){
>>> final String dataStoreName = "LibraryDataStore";
>>> final Session session = StoreController.getInstance().getSession();
>>> final Transaction tx = session.getTransaction();
>>> session.beginTransaction();
>>> //Create and populate Library
>>> Library library = LibraryFactory.eINSTANCE.createLibrary();
>>> library.setName("My Library");
>>> // Make it persistent.
>>> session.save(library);
>>> // Create a writer...
>>> Writer writer = LibraryFactory.eINSTANCE.createWriter();
>>> writer.setName("JRR Tolkien");
>>> // ...and one of his books.
>>> Book book = LibraryFactory.eINSTANCE.createBook();
>>> book.setAuthor(writer);
>>> book.setPages(305);
>>> book.setTitle("The Hobbit");
>>> book.setCategory(BookCategory.SCIENCE_FICTION);
>>> // Add the Writer and Book to the Library. They are made
>>> // persistent automatically because the Library is itself
>>> // already persistent.
>>> library.getWriters().add(writer);
>>> library.getBooks().add(book);
>>> //Commit Transaction and close Session
>>> //The Library is not stored in the database until you commit the
>>> Transaction:
>>> session.getTransaction().commit();
>>> session.close();
>>> }
>>>
>>> During database schema update call, I am getting the following error .
>>>
>>> Could not determine type for:
>>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book,
>>> for columns: [org.hibernate.mapping.Column(category)]
>>> org.hibernate.MappingException: Could not determine type for:
>>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book,
>>> for columns: [org.hibernate.mapping.Column(category)]
>>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>>> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
>>> at org.hibernate.mapping.Property.isValid(Property.java:185)
>>> at
>>> org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:440)
>>> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
>>> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1108)
>>> at
>>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1293)
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:172)
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:86)
>>> at test.StoreController.initializeDataStore(StoreController.jav a:65)
>>> at test.StoreController.getDataStore(StoreController.java:31)
>>> at test.StoreController.getSession(StoreController.java:26)
>>> at test.TestTeneo.testAddBook(TestTeneo.java:46)
>>>
>>> What am I missing ?
>>>
>>> Appreciate your help
>>> Thanks
>>> Prasad
>>>
>>
>>
>
>
> --
>
> With Regards, Martin Taal
>
> Springsite/Elver.org
> Office: Hardwareweg 4, 3821 BV Amersfoort
> Postal: Nassaulaan 7, 3941 EC Doorn
> The Netherlands
> 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] newbee question .. MappingException: Could not determine type for: [message #116748 is a reply to message #116735] Thu, 03 April 2008 12:30 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Ok good, btw you can simplify the initialization of the datastore by getting rid of the part that
reads the epackage on the basis of the nsuri, if you have programmatic access (at compile time) to
the epackages then you can also do this:

localDataStore.setEPackages(new EPackage[]{LibraryPackage.eINSTANCE});

gr. Martin

prasad wrote:
> Great !! That did the trick. Sorry about missing that instruction in the
> first place.
>
>
> thanks
> Prasad
>
>
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:ft2hop$un$1@build.eclipse.org...
>> Hi Prasad,
>> This could also be a class-loading/plugin dependency issue (that hibernate
>> can not see the teneo hibernate.mapper classes).
>>
>> Can you let me know how you setup the hibernate libraries? Did you put
>> them in a separate plugin with Eclipse-Buddypolicy: dependent in the
>> manifest.mf?
>>
>> gr. Martin
>>
>> Martin Taal wrote:
>>> Hi Prasad,
>>> How does the StoreController initialize the Teneo datastore, can you post
>>> that part of the code?
>>>
>>> gr. Martin
>>>
>>> prasad wrote:
>>>> hi,
>>>> I have just started with the library tutorial on elver.org. The library
>>>> xsd is attached.
>>>> I have done the following things:
>>>> 1) created model and edit plugins for the library xsd
>>>> 2) setup a hsql server instance , created a library db and modified the
>>>> hibernate properties accordingly.
>>>> 3) I am using the versions we got from the eclipsecon2008 Teneo session
>>>> in model-driven-dev tutorial on first day.
>>>> [ except hsql related, which I took the latest from hsql.org ] .
>>>>
>>>> here is the test method I am invoking from a view class of another
>>>> plugin ..
>>>>
>>>> public String testAddBook(){
>>>> final String dataStoreName = "LibraryDataStore";
>>>> final Session session = StoreController.getInstance().getSession();
>>>> final Transaction tx = session.getTransaction();
>>>> session.beginTransaction();
>>>> //Create and populate Library
>>>> Library library = LibraryFactory.eINSTANCE.createLibrary();
>>>> library.setName("My Library");
>>>> // Make it persistent.
>>>> session.save(library);
>>>> // Create a writer...
>>>> Writer writer = LibraryFactory.eINSTANCE.createWriter();
>>>> writer.setName("JRR Tolkien");
>>>> // ...and one of his books.
>>>> Book book = LibraryFactory.eINSTANCE.createBook();
>>>> book.setAuthor(writer);
>>>> book.setPages(305);
>>>> book.setTitle("The Hobbit");
>>>> book.setCategory(BookCategory.SCIENCE_FICTION);
>>>> // Add the Writer and Book to the Library. They are made
>>>> // persistent automatically because the Library is itself
>>>> // already persistent.
>>>> library.getWriters().add(writer);
>>>> library.getBooks().add(book);
>>>> //Commit Transaction and close Session
>>>> //The Library is not stored in the database until you commit the
>>>> Transaction:
>>>> session.getTransaction().commit();
>>>> session.close();
>>>> }
>>>>
>>>> During database schema update call, I am getting the following error .
>>>>
>>>> Could not determine type for:
>>>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book,
>>>> for columns: [org.hibernate.mapping.Column(category)]
>>>> org.hibernate.MappingException: Could not determine type for:
>>>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book,
>>>> for columns: [org.hibernate.mapping.Column(category)]
>>>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>>>> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
>>>> at org.hibernate.mapping.Property.isValid(Property.java:185)
>>>> at
>>>> org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:440)
>>>> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
>>>> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1108)
>>>> at
>>>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1293)
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:172)
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:86)
>>>> at test.StoreController.initializeDataStore(StoreController.jav a:65)
>>>> at test.StoreController.getDataStore(StoreController.java:31)
>>>> at test.StoreController.getSession(StoreController.java:26)
>>>> at test.TestTeneo.testAddBook(TestTeneo.java:46)
>>>>
>>>> What am I missing ?
>>>>
>>>> Appreciate your help
>>>> Thanks
>>>> Prasad
>>>>
>>>
>>
>> --
>>
>> With Regards, Martin Taal
>>
>> Springsite/Elver.org
>> Office: Hardwareweg 4, 3821 BV Amersfoort
>> Postal: Nassaulaan 7, 3941 EC Doorn
>> The Netherlands
>> 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
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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] newbee question .. MappingException: Could not determine type for: [message #616061 is a reply to message #116598] Thu, 03 April 2008 12:00 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Prasad,
How does the StoreController initialize the Teneo datastore, can you post that part of the code?

gr. Martin

prasad wrote:
> hi,
> I have just started with the library tutorial on elver.org. The library xsd
> is attached.
> I have done the following things:
> 1) created model and edit plugins for the library xsd
> 2) setup a hsql server instance , created a library db and modified the
> hibernate properties accordingly.
> 3) I am using the versions we got from the eclipsecon2008 Teneo session in
> model-driven-dev tutorial on first day.
> [ except hsql related, which I took the latest from hsql.org ] .
>
> here is the test method I am invoking from a view class of another plugin ..
>
> public String testAddBook(){
> final String dataStoreName = "LibraryDataStore";
> final Session session = StoreController.getInstance().getSession();
> final Transaction tx = session.getTransaction();
> session.beginTransaction();
> //Create and populate Library
> Library library = LibraryFactory.eINSTANCE.createLibrary();
> library.setName("My Library");
> // Make it persistent.
> session.save(library);
> // Create a writer...
> Writer writer = LibraryFactory.eINSTANCE.createWriter();
> writer.setName("JRR Tolkien");
> // ...and one of his books.
> Book book = LibraryFactory.eINSTANCE.createBook();
> book.setAuthor(writer);
> book.setPages(305);
> book.setTitle("The Hobbit");
> book.setCategory(BookCategory.SCIENCE_FICTION);
> // Add the Writer and Book to the Library. They are made
> // persistent automatically because the Library is itself
> // already persistent.
> library.getWriters().add(writer);
> library.getBooks().add(book);
> //Commit Transaction and close Session
> //The Library is not stored in the database until you commit the
> Transaction:
> session.getTransaction().commit();
> session.close();
> }
>
> During database schema update call, I am getting the following error .
>
> Could not determine type for:
> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book, for
> columns: [org.hibernate.mapping.Column(category)]
> org.hibernate.MappingException: Could not determine type for:
> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book, for
> columns: [org.hibernate.mapping.Column(category)]
> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
> at org.hibernate.mapping.Property.isValid(Property.java:185)
> at org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:440)
> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1108)
> at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1293)
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:172)
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:86)
> at test.StoreController.initializeDataStore(StoreController.jav a:65)
> at test.StoreController.getDataStore(StoreController.java:31)
> at test.StoreController.getSession(StoreController.java:26)
> at test.TestTeneo.testAddBook(TestTeneo.java:46)
>
> What am I missing ?
>
> Appreciate your help
> Thanks
> Prasad
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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] newbee question .. MappingException: Could not determine type for: [message #616062 is a reply to message #116703] Thu, 03 April 2008 12:15 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Prasad,
This could also be a class-loading/plugin dependency issue (that hibernate can not see the teneo
hibernate.mapper classes).

Can you let me know how you setup the hibernate libraries? Did you put them in a separate plugin
with Eclipse-Buddypolicy: dependent in the manifest.mf?

gr. Martin

Martin Taal wrote:
> Hi Prasad,
> How does the StoreController initialize the Teneo datastore, can you
> post that part of the code?
>
> gr. Martin
>
> prasad wrote:
>> hi,
>> I have just started with the library tutorial on elver.org. The
>> library xsd is attached.
>> I have done the following things:
>> 1) created model and edit plugins for the library xsd
>> 2) setup a hsql server instance , created a library db and modified
>> the hibernate properties accordingly.
>> 3) I am using the versions we got from the eclipsecon2008 Teneo
>> session in model-driven-dev tutorial on first day.
>> [ except hsql related, which I took the latest from hsql.org ] .
>>
>> here is the test method I am invoking from a view class of another
>> plugin ..
>>
>> public String testAddBook(){
>> final String dataStoreName = "LibraryDataStore";
>> final Session session = StoreController.getInstance().getSession();
>> final Transaction tx = session.getTransaction();
>> session.beginTransaction();
>> //Create and populate Library
>> Library library = LibraryFactory.eINSTANCE.createLibrary();
>> library.setName("My Library");
>> // Make it persistent.
>> session.save(library);
>> // Create a writer...
>> Writer writer = LibraryFactory.eINSTANCE.createWriter();
>> writer.setName("JRR Tolkien");
>> // ...and one of his books.
>> Book book = LibraryFactory.eINSTANCE.createBook();
>> book.setAuthor(writer);
>> book.setPages(305);
>> book.setTitle("The Hobbit");
>> book.setCategory(BookCategory.SCIENCE_FICTION);
>> // Add the Writer and Book to the Library. They are made
>> // persistent automatically because the Library is itself
>> // already persistent.
>> library.getWriters().add(writer);
>> library.getBooks().add(book);
>> //Commit Transaction and close Session
>> //The Library is not stored in the database until you commit the
>> Transaction:
>> session.getTransaction().commit();
>> session.close();
>> }
>>
>> During database schema update call, I am getting the following error .
>>
>> Could not determine type for:
>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book,
>> for columns: [org.hibernate.mapping.Column(category)]
>> org.hibernate.MappingException: Could not determine type for:
>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book,
>> for columns: [org.hibernate.mapping.Column(category)]
>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
>> at org.hibernate.mapping.Property.isValid(Property.java:185)
>> at
>> org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:440)
>> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
>> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1108)
>> at
>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1293)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:172)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:86)
>>
>> at test.StoreController.initializeDataStore(StoreController.jav a:65)
>> at test.StoreController.getDataStore(StoreController.java:31)
>> at test.StoreController.getSession(StoreController.java:26)
>> at test.TestTeneo.testAddBook(TestTeneo.java:46)
>>
>> What am I missing ?
>>
>> Appreciate your help
>> Thanks
>> Prasad
>>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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] newbee question .. MappingException: Could not determine type for: [message #616063 is a reply to message #116703] Thu, 03 April 2008 12:15 Go to previous message
prasad is currently offline prasadFriend
Messages: 22
Registered: July 2009
Junior Member
hi Martin,

here it is:

package test;


import java.io.IOException;

import java.util.Properties;


import org.eclipse.emf.common.util.URI;

import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.teneo.PersistenceOptions;

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

import org.eclipse.emf.teneo.hibernate.HbSessionDataStore;

import org.hibernate.Session;


public class StoreController {


public static final URI DATABASE_URI = URI

..createURI("hibernate://?dsname=library");


private static StoreController instance = new StoreController();


public static StoreController getInstance() {

return instance;

}


private HbSessionDataStore dataStore = null;


public Session getSession() {

return getDataStore().getSessionFactory().openSession();

}


public HbSessionDataStore getDataStore() {

if (dataStore == null) {

dataStore = initializeDataStore();

}


return dataStore;

}


public void closeDataStore() {

getDataStore().close();

}


public HbSessionDataStore initializeDataStore() {

final HbSessionDataStore localDataStore = new HbSessionDataStore();

localDataStore.setName("library");

HbHelper.INSTANCE.register(localDataStore);


final Properties props = new Properties();

try {

props

..load(this.getClass().getResourceAsStream(

"/teneo.properties"));

//props.put(PersistenceOptions.USE_MAPPING_FILE, true);

} catch (IOException e) {

throw new IllegalStateException(e);

}

localDataStore.setProperties(props);


// get the epackage nsuri

final String[] nsuris = props.getProperty("nsuri").split(",");

final EPackage[] ePackages = new EPackage[nsuris.length];

int i = 0;

for (String nsuri : nsuris) {

ePackages[i++] = EPackage.Registry.INSTANCE.getEPackage(nsuri

..trim());

}

localDataStore.setEPackages(ePackages);

localDataStore.initialize();


System.err.println(localDataStore.getMappingXML());


return localDataStore;

}

}







"Martin Taal" <mtaal@elver.org> wrote in message
news:ft2gsh$ft3$1@build.eclipse.org...
> Hi Prasad,
> How does the StoreController initialize the Teneo datastore, can you post
> that part of the code?
>
> gr. Martin
>
> prasad wrote:
>> hi,
>> I have just started with the library tutorial on elver.org. The library
>> xsd is attached.
>> I have done the following things:
>> 1) created model and edit plugins for the library xsd
>> 2) setup a hsql server instance , created a library db and modified the
>> hibernate properties accordingly.
>> 3) I am using the versions we got from the eclipsecon2008 Teneo session
>> in model-driven-dev tutorial on first day.
>> [ except hsql related, which I took the latest from hsql.org ] .
>>
>> here is the test method I am invoking from a view class of another plugin
>> ..
>>
>> public String testAddBook(){
>> final String dataStoreName = "LibraryDataStore";
>> final Session session = StoreController.getInstance().getSession();
>> final Transaction tx = session.getTransaction();
>> session.beginTransaction();
>> //Create and populate Library
>> Library library = LibraryFactory.eINSTANCE.createLibrary();
>> library.setName("My Library");
>> // Make it persistent.
>> session.save(library);
>> // Create a writer...
>> Writer writer = LibraryFactory.eINSTANCE.createWriter();
>> writer.setName("JRR Tolkien");
>> // ...and one of his books.
>> Book book = LibraryFactory.eINSTANCE.createBook();
>> book.setAuthor(writer);
>> book.setPages(305);
>> book.setTitle("The Hobbit");
>> book.setCategory(BookCategory.SCIENCE_FICTION);
>> // Add the Writer and Book to the Library. They are made
>> // persistent automatically because the Library is itself
>> // already persistent.
>> library.getWriters().add(writer);
>> library.getBooks().add(book);
>> //Commit Transaction and close Session
>> //The Library is not stored in the database until you commit the
>> Transaction:
>> session.getTransaction().commit();
>> session.close();
>> }
>>
>> During database schema update call, I am getting the following error .
>>
>> Could not determine type for:
>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book, for
>> columns: [org.hibernate.mapping.Column(category)]
>> org.hibernate.MappingException: Could not determine type for:
>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book, for
>> columns: [org.hibernate.mapping.Column(category)]
>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
>> at org.hibernate.mapping.Property.isValid(Property.java:185)
>> at
>> org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:440)
>> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
>> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1108)
>> at
>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1293)
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:172)
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:86)
>> at test.StoreController.initializeDataStore(StoreController.jav a:65)
>> at test.StoreController.getDataStore(StoreController.java:31)
>> at test.StoreController.getSession(StoreController.java:26)
>> at test.TestTeneo.testAddBook(TestTeneo.java:46)
>>
>> What am I missing ?
>>
>> Appreciate your help
>> Thanks
>> Prasad
>
>
> --
>
> With Regards, Martin Taal
>
> Springsite/Elver.org
> Office: Hardwareweg 4, 3821 BV Amersfoort
> Postal: Nassaulaan 7, 3941 EC Doorn
> The Netherlands
> 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] newbee question .. MappingException: Could not determine type for: [message #616064 is a reply to message #116715] Thu, 03 April 2008 12:24 Go to previous message
prasad is currently offline prasadFriend
Messages: 22
Registered: July 2009
Junior Member
Great !! That did the trick. Sorry about missing that instruction in the
first place.


thanks
Prasad



"Martin Taal" <mtaal@elver.org> wrote in message
news:ft2hop$un$1@build.eclipse.org...
> Hi Prasad,
> This could also be a class-loading/plugin dependency issue (that hibernate
> can not see the teneo hibernate.mapper classes).
>
> Can you let me know how you setup the hibernate libraries? Did you put
> them in a separate plugin with Eclipse-Buddypolicy: dependent in the
> manifest.mf?
>
> gr. Martin
>
> Martin Taal wrote:
>> Hi Prasad,
>> How does the StoreController initialize the Teneo datastore, can you post
>> that part of the code?
>>
>> gr. Martin
>>
>> prasad wrote:
>>> hi,
>>> I have just started with the library tutorial on elver.org. The library
>>> xsd is attached.
>>> I have done the following things:
>>> 1) created model and edit plugins for the library xsd
>>> 2) setup a hsql server instance , created a library db and modified the
>>> hibernate properties accordingly.
>>> 3) I am using the versions we got from the eclipsecon2008 Teneo session
>>> in model-driven-dev tutorial on first day.
>>> [ except hsql related, which I took the latest from hsql.org ] .
>>>
>>> here is the test method I am invoking from a view class of another
>>> plugin ..
>>>
>>> public String testAddBook(){
>>> final String dataStoreName = "LibraryDataStore";
>>> final Session session = StoreController.getInstance().getSession();
>>> final Transaction tx = session.getTransaction();
>>> session.beginTransaction();
>>> //Create and populate Library
>>> Library library = LibraryFactory.eINSTANCE.createLibrary();
>>> library.setName("My Library");
>>> // Make it persistent.
>>> session.save(library);
>>> // Create a writer...
>>> Writer writer = LibraryFactory.eINSTANCE.createWriter();
>>> writer.setName("JRR Tolkien");
>>> // ...and one of his books.
>>> Book book = LibraryFactory.eINSTANCE.createBook();
>>> book.setAuthor(writer);
>>> book.setPages(305);
>>> book.setTitle("The Hobbit");
>>> book.setCategory(BookCategory.SCIENCE_FICTION);
>>> // Add the Writer and Book to the Library. They are made
>>> // persistent automatically because the Library is itself
>>> // already persistent.
>>> library.getWriters().add(writer);
>>> library.getBooks().add(book);
>>> //Commit Transaction and close Session
>>> //The Library is not stored in the database until you commit the
>>> Transaction:
>>> session.getTransaction().commit();
>>> session.close();
>>> }
>>>
>>> During database schema update call, I am getting the following error .
>>>
>>> Could not determine type for:
>>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book,
>>> for columns: [org.hibernate.mapping.Column(category)]
>>> org.hibernate.MappingException: Could not determine type for:
>>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book,
>>> for columns: [org.hibernate.mapping.Column(category)]
>>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>>> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
>>> at org.hibernate.mapping.Property.isValid(Property.java:185)
>>> at
>>> org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:440)
>>> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
>>> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1108)
>>> at
>>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1293)
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:172)
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:86)
>>> at test.StoreController.initializeDataStore(StoreController.jav a:65)
>>> at test.StoreController.getDataStore(StoreController.java:31)
>>> at test.StoreController.getSession(StoreController.java:26)
>>> at test.TestTeneo.testAddBook(TestTeneo.java:46)
>>>
>>> What am I missing ?
>>>
>>> Appreciate your help
>>> Thanks
>>> Prasad
>>>
>>
>>
>
>
> --
>
> With Regards, Martin Taal
>
> Springsite/Elver.org
> Office: Hardwareweg 4, 3821 BV Amersfoort
> Postal: Nassaulaan 7, 3941 EC Doorn
> The Netherlands
> 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] newbee question .. MappingException: Could not determine type for: [message #616065 is a reply to message #116735] Thu, 03 April 2008 12:30 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Ok good, btw you can simplify the initialization of the datastore by getting rid of the part that
reads the epackage on the basis of the nsuri, if you have programmatic access (at compile time) to
the epackages then you can also do this:

localDataStore.setEPackages(new EPackage[]{LibraryPackage.eINSTANCE});

gr. Martin

prasad wrote:
> Great !! That did the trick. Sorry about missing that instruction in the
> first place.
>
>
> thanks
> Prasad
>
>
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:ft2hop$un$1@build.eclipse.org...
>> Hi Prasad,
>> This could also be a class-loading/plugin dependency issue (that hibernate
>> can not see the teneo hibernate.mapper classes).
>>
>> Can you let me know how you setup the hibernate libraries? Did you put
>> them in a separate plugin with Eclipse-Buddypolicy: dependent in the
>> manifest.mf?
>>
>> gr. Martin
>>
>> Martin Taal wrote:
>>> Hi Prasad,
>>> How does the StoreController initialize the Teneo datastore, can you post
>>> that part of the code?
>>>
>>> gr. Martin
>>>
>>> prasad wrote:
>>>> hi,
>>>> I have just started with the library tutorial on elver.org. The library
>>>> xsd is attached.
>>>> I have done the following things:
>>>> 1) created model and edit plugins for the library xsd
>>>> 2) setup a hsql server instance , created a library db and modified the
>>>> hibernate properties accordingly.
>>>> 3) I am using the versions we got from the eclipsecon2008 Teneo session
>>>> in model-driven-dev tutorial on first day.
>>>> [ except hsql related, which I took the latest from hsql.org ] .
>>>>
>>>> here is the test method I am invoking from a view class of another
>>>> plugin ..
>>>>
>>>> public String testAddBook(){
>>>> final String dataStoreName = "LibraryDataStore";
>>>> final Session session = StoreController.getInstance().getSession();
>>>> final Transaction tx = session.getTransaction();
>>>> session.beginTransaction();
>>>> //Create and populate Library
>>>> Library library = LibraryFactory.eINSTANCE.createLibrary();
>>>> library.setName("My Library");
>>>> // Make it persistent.
>>>> session.save(library);
>>>> // Create a writer...
>>>> Writer writer = LibraryFactory.eINSTANCE.createWriter();
>>>> writer.setName("JRR Tolkien");
>>>> // ...and one of his books.
>>>> Book book = LibraryFactory.eINSTANCE.createBook();
>>>> book.setAuthor(writer);
>>>> book.setPages(305);
>>>> book.setTitle("The Hobbit");
>>>> book.setCategory(BookCategory.SCIENCE_FICTION);
>>>> // Add the Writer and Book to the Library. They are made
>>>> // persistent automatically because the Library is itself
>>>> // already persistent.
>>>> library.getWriters().add(writer);
>>>> library.getBooks().add(book);
>>>> //Commit Transaction and close Session
>>>> //The Library is not stored in the database until you commit the
>>>> Transaction:
>>>> session.getTransaction().commit();
>>>> session.close();
>>>> }
>>>>
>>>> During database schema update call, I am getting the following error .
>>>>
>>>> Could not determine type for:
>>>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book,
>>>> for columns: [org.hibernate.mapping.Column(category)]
>>>> org.hibernate.MappingException: Could not determine type for:
>>>> org.eclipse.emf.teneo.hibernate.mapping.ENumUserType, at table: book,
>>>> for columns: [org.hibernate.mapping.Column(category)]
>>>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>>>> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
>>>> at org.hibernate.mapping.Property.isValid(Property.java:185)
>>>> at
>>>> org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:440)
>>>> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
>>>> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1108)
>>>> at
>>>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1293)
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:172)
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:86)
>>>> at test.StoreController.initializeDataStore(StoreController.jav a:65)
>>>> at test.StoreController.getDataStore(StoreController.java:31)
>>>> at test.StoreController.getSession(StoreController.java:26)
>>>> at test.TestTeneo.testAddBook(TestTeneo.java:46)
>>>>
>>>> What am I missing ?
>>>>
>>>> Appreciate your help
>>>> Thanks
>>>> Prasad
>>>>
>>>
>>
>> --
>>
>> With Regards, Martin Taal
>>
>> Springsite/Elver.org
>> Office: Hardwareweg 4, 3821 BV Amersfoort
>> Postal: Nassaulaan 7, 3941 EC Doorn
>> The Netherlands
>> 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
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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
Previous Topic:[Teneo] newbee question .. MappingException: Could not determine type for:
Next Topic:[Teneo] Generating JPA Annotations in Java Code
Goto Forum:
  


Current Time: Thu Apr 25 22:33:35 GMT 2024

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

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

Back to the top