Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Resolve][Teneo] - Howto copy EMF model from one database to another one
[Resolve][Teneo] - Howto copy EMF model from one database to another one [message #1019264] Fri, 15 March 2013 10:39 Go to next message
Philippe EUGENE is currently offline Philippe EUGENEFriend
Messages: 58
Registered: January 2011
Member
Hi,

I try to explain my problem.

Use Case:
Copy and share EMF model, persist with Teneo in derby database, between multi-users. And after re-import and merge datas.

Constraints:
Could not use a CDO server to share model througth the network.

Solution:
Adding teneo annotations to the EMF model to generate a primary key and use a UUID strategy to generate ID. The goal of this strategy is to limit the risk of colision between ID.

The Problem:
- I copy the root element of my EMF model => all ID are well copied.
- I save the root element to the new DB. The save action change all ID.

I think my way to proceed is bad. I use an hibernate Session.
Using an hibernate session not work.

The object don't exist in the new database and then Hibernate change all id.
This is the contract of the Hibernate Session (save, saveOrUpdate and so on).

There is an other way to do that with Teneo ?


// Here i initialize a new HbDataStore
// uri: the uri of the new database (derby)
// datastoreName: a new name for this datastore.
// There is a first datastore register with an other name in my application.
HbDataStore datastore = init(uri, dataStorename);  

// After i proceed with an hibernate session				
final SessionFactory sessionFactory = datastore.getSessionFactory();

// Open a new Session and start transaction.
final Session session = sessionFactory.openSession();
session.beginTransaction();

// Copy the the root element of my EMF model.
// here all ID of the copy are good.
Root copy = EcoreUtil.copy(root);

... do some stuff with the copy => remove some datas ...

// call the save or update
session.saveOrUpdate(copy);
// here all the ID in the new databases will be changed by hibernate.
// I try: save, saveOrUpdate and persist the behavior is the same.



Thanks for help and reply,
--
Philippe

[Updated on: Fri, 15 March 2013 13:08]

Report message to a moderator

Re: [Teneo] - Howto copy EMF model from one database to another one [message #1019308 is a reply to message #1019264] Fri, 15 March 2013 12:16 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Philippe,
Yes that the id changes is standard behavior from hibernate. To solve this, create a UUID generator class (see below).
Then add this annotation to the id efeature:
@GeneratedValue(generator="MyIDGenerator")

and this one to the epackage:
@GenericGenerator(name="MyIDGenerator", strategy="class.MyUUIDGenerator")

(where class.MyUUIDGenerator is the custom uuid generator)

public class MyUUIDGenerator extends UUIDGenerator {

@Override
public Serializable generate(SessionImplementor session, Object obj) throws HibernateException {
// get the id from the object, if it is there (not null)
// then return this id
// otherwise do:
return super.generate(session, obj);
}
}

gr. Martin


On 03/15/2013 11:39 AM, peugene Mising name wrote:
> Hi,
>
> I try to explain my problem.
>
> Use Case: Copy and share EMF model, persist with Teneo in derby database, between multi-users. And after re-import and
> merge datas.
>
> Constraints: Could not use a CDO server to share model througth the network.
> Solution:
> Adding teneo annotations to the EMF model to generate a primary key and use a UUID strategy to generate ID. The goal of
> this strategy is to limit the risk of colision between ID.
> The Problem:
> - I copy the root element of my EMF model => all ID are well copied.
> - I save the root element to the new DB. The save action change all ID.
>
> I think my way to proceed is bad. I use an hibernate Session. Using an hibernate session not work.
>
> The object don't exist in the new database and then Hibernate change all id.
> This is the contract of the Hibernate Session (save, saveOrUpdate and so on).
>
> There is an other way to do that with Teneo ?
>
>
>
> // Here i initialize a new HbDataStore
> // uri: the uri of the new database (derby)
> // datastoreName: a new name for this datastore.
> // There is a first datastore register with an other name in my application.
> HbDataStore datastore = init(uri, dataStorename);
> // After i proceed with an hibernate session
> final SessionFactory sessionFactory = datastore.getSessionFactory();
>
> // Open a new Session and start transaction.
> final Session session = sessionFactory.openSession();
> session.beginTransaction();
>
> // Copy the the root element of my EMF model.
> // here all ID of the copy are good.
> Root copy = EcoreUtil.copy(root);
>
> ... do some stuff with the copy => remove some datas ...
>
> // call the save or update
> session.saveOrUpdate(copy);
> // here all the ID in the new databases will be changed by hibernate.
> // I try: save, saveOrUpdate and persist the behavior is the same.
>
>
>
> Thanks for help and reply,
> --
> Philippe


--

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@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Teneo] - Howto copy EMF model from one database to another one [message #1019331 is a reply to message #1019308] Fri, 15 March 2013 13:08 Go to previous messageGo to next message
Philippe EUGENE is currently offline Philippe EUGENEFriend
Messages: 58
Registered: January 2011
Member
Thanks Martin,
It's work fine.
Re: [Teneo] - Howto copy EMF model from one database to another one [message #1037316 is a reply to message #1019308] Tue, 09 April 2013 12:08 Go to previous messageGo to next message
J. Michael Dean, M.D. is currently offline J. Michael Dean, M.D.Friend
Messages: 218
Registered: July 2009
Senior Member
On 3/15/13 6:16 AM, Martin Taal wrote:
> Hi Philippe,
> Yes that the id changes is standard behavior from hibernate. To solve
> this, create a UUID generator class (see below). Then add this
> annotation to the id efeature:
> @GeneratedValue(generator="MyIDGenerator")
>
> and this one to the epackage:
> @GenericGenerator(name="MyIDGenerator", strategy="class.MyUUIDGenerator")
>
> (where class.MyUUIDGenerator is the custom uuid generator)
>
> public class MyUUIDGenerator extends UUIDGenerator {
>
> @Override
> public Serializable generate(SessionImplementor session, Object obj)
> throws HibernateException {
> // get the id from the object, if it is there (not null)
> // then return this id
> // otherwise do:
> return super.generate(session, obj);
> }
> }
>
> gr. Martin
>
>
> On 03/15/2013 11:39 AM, peugene Mising name wrote:
>> Hi,
>>
>> I try to explain my problem.
>>
>> Use Case: Copy and share EMF model, persist with Teneo in derby
>> database, between multi-users. And after re-import and
>> merge datas.
>>
>> Constraints: Could not use a CDO server to share model througth the
>> network.
>> Solution:
>> Adding teneo annotations to the EMF model to generate a primary key
>> and use a UUID strategy to generate ID. The goal of
>> this strategy is to limit the risk of colision between ID.
>> The Problem:
>> - I copy the root element of my EMF model => all ID are well copied.
>> - I save the root element to the new DB. The save action change all ID.
>>
>> I think my way to proceed is bad. I use an hibernate Session. Using an
>> hibernate session not work.
>>
>> The object don't exist in the new database and then Hibernate change
>> all id.
>> This is the contract of the Hibernate Session (save, saveOrUpdate and
>> so on).
>>
>> There is an other way to do that with Teneo ?
>>
>>
>>
>> // Here i initialize a new HbDataStore
>> // uri: the uri of the new database (derby)
>> // datastoreName: a new name for this datastore.
>> // There is a first datastore register with an other name in my
>> application.
>> HbDataStore datastore = init(uri, dataStorename);
>> // After i proceed with an hibernate session
>> final SessionFactory sessionFactory = datastore.getSessionFactory();
>>
>> // Open a new Session and start transaction.
>> final Session session = sessionFactory.openSession();
>> session.beginTransaction();
>>
>> // Copy the the root element of my EMF model.
>> // here all ID of the copy are good.
>> Root copy = EcoreUtil.copy(root);
>>
>> ... do some stuff with the copy => remove some datas ...
>>
>> // call the save or update
>> session.saveOrUpdate(copy);
>> // here all the ID in the new databases will be changed by hibernate.
>> // I try: save, saveOrUpdate and persist the behavior is the same.
>>
>>
>>
>> Thanks for help and reply,
>> --
>> Philippe
>
>
I am trying to move an old Hibernate project into EMF and have a related
issue. The original code includes the following snippets:

==================================================================
@MappedSuperclass
@org.hibernate.annotations.GenericGenerator(name="hibernate-uuid",
strategy = "uuid")
public class BaseEntity implements Identifiable {

private String id;
private int version;
protected Boolean valid = true;

public BaseEntity() {
this.valid = true;
}

@Id
@GeneratedValue(generator="hibernate-uuid")
public String getId() {
return id;
}

@Entity
@org.hibernate.annotations.GenericGenerator(name="hibernate-uuid",
strategy = "uuid")
public class Patient extends ModelObject{
etc.
}
==================================================================

I am unclear how these annotations should be added to an eCore model in
which I am allowing EMF to automatically generate the e_id, etc. for
different objects. The name and strategy that I have shown above
results in errors that they are not recognized.

Unfortunately my knowledge of EMF is struggling up the steep part of the
learning curve; I interpret your advice to Phillipe to mean to hand
edit the generated code, but I am interested in getting as much as
possible into the eCore model itself.

Thanks for thinking about this.

- Mike
Re: [Teneo] - Howto copy EMF model from one database to another one [message #1037384 is a reply to message #1037316] Tue, 09 April 2013 13:39 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Mike,
No my proposal was not to change the generated code. It was all adding annotations to ecore.

The GenericGenerator annotation can be be added to the epackage using an eannotation there. For the @Id and
@GeneratedValue annotations these can be added/set in the eattribute, the @MappedSuperclass can be set on the EClass.
The @Entity annotation is not needed, teneo will generate it.

I am sure that you found the wiki documents on setting annotations in ecore:
http://wiki.eclipse.org/Teneo/Hibernate#Model_Relational_Mapping_with_EJB3.2FJPA_Annotations

And on another approach, if you like to have your annotations in the java code you can also try the texo project which
tries to combine the best of both worlds, EMF and standard java/JPA:
http://wiki.eclipse.org/Texo

gr. Martin

On 04/09/2013 02:08 PM, J Michael Dean wrote:
> On 3/15/13 6:16 AM, Martin Taal wrote:
>> Hi Philippe,
>> Yes that the id changes is standard behavior from hibernate. To solve
>> this, create a UUID generator class (see below). Then add this
>> annotation to the id efeature:
>> @GeneratedValue(generator="MyIDGenerator")
>>
>> and this one to the epackage:
>> @GenericGenerator(name="MyIDGenerator", strategy="class.MyUUIDGenerator")
>>
>> (where class.MyUUIDGenerator is the custom uuid generator)
>>
>> public class MyUUIDGenerator extends UUIDGenerator {
>>
>> @Override
>> public Serializable generate(SessionImplementor session, Object obj)
>> throws HibernateException {
>> // get the id from the object, if it is there (not null)
>> // then return this id
>> // otherwise do:
>> return super.generate(session, obj);
>> }
>> }
>>
>> gr. Martin
>>
>>
>> On 03/15/2013 11:39 AM, peugene Mising name wrote:
>>> Hi,
>>>
>>> I try to explain my problem.
>>>
>>> Use Case: Copy and share EMF model, persist with Teneo in derby
>>> database, between multi-users. And after re-import and
>>> merge datas.
>>>
>>> Constraints: Could not use a CDO server to share model througth the
>>> network.
>>> Solution:
>>> Adding teneo annotations to the EMF model to generate a primary key
>>> and use a UUID strategy to generate ID. The goal of
>>> this strategy is to limit the risk of colision between ID.
>>> The Problem:
>>> - I copy the root element of my EMF model => all ID are well copied.
>>> - I save the root element to the new DB. The save action change all ID.
>>>
>>> I think my way to proceed is bad. I use an hibernate Session. Using an
>>> hibernate session not work.
>>>
>>> The object don't exist in the new database and then Hibernate change
>>> all id.
>>> This is the contract of the Hibernate Session (save, saveOrUpdate and
>>> so on).
>>>
>>> There is an other way to do that with Teneo ?
>>>
>>>
>>>
>>> // Here i initialize a new HbDataStore
>>> // uri: the uri of the new database (derby)
>>> // datastoreName: a new name for this datastore.
>>> // There is a first datastore register with an other name in my
>>> application.
>>> HbDataStore datastore = init(uri, dataStorename);
>>> // After i proceed with an hibernate session
>>> final SessionFactory sessionFactory = datastore.getSessionFactory();
>>>
>>> // Open a new Session and start transaction.
>>> final Session session = sessionFactory.openSession();
>>> session.beginTransaction();
>>>
>>> // Copy the the root element of my EMF model.
>>> // here all ID of the copy are good.
>>> Root copy = EcoreUtil.copy(root);
>>>
>>> ... do some stuff with the copy => remove some datas ...
>>>
>>> // call the save or update
>>> session.saveOrUpdate(copy);
>>> // here all the ID in the new databases will be changed by hibernate.
>>> // I try: save, saveOrUpdate and persist the behavior is the same.
>>>
>>>
>>>
>>> Thanks for help and reply,
>>> --
>>> Philippe
>>
>>
> I am trying to move an old Hibernate project into EMF and have a related issue. The original code includes the
> following snippets:
>
> ==================================================================
> @MappedSuperclass
> @org.hibernate.annotations.GenericGenerator(name="hibernate-uuid", strategy = "uuid")
> public class BaseEntity implements Identifiable {
>
> private String id;
> private int version;
> protected Boolean valid = true;
>
> public BaseEntity() {
> this.valid = true;
> }
>
> @Id
> @GeneratedValue(generator="hibernate-uuid")
> public String getId() {
> return id;
> }
>
> @Entity
> @org.hibernate.annotations.GenericGenerator(name="hibernate-uuid", strategy = "uuid")
> public class Patient extends ModelObject{
> etc.
> }
> ==================================================================
>
> I am unclear how these annotations should be added to an eCore model in which I am allowing EMF to automatically
> generate the e_id, etc. for different objects. The name and strategy that I have shown above results in errors that
> they are not recognized.
>
> Unfortunately my knowledge of EMF is struggling up the steep part of the learning curve; I interpret your advice to
> Phillipe to mean to hand edit the generated code, but I am interested in getting as much as possible into the eCore
> model itself.
>
> Thanks for thinking about this.
>
> - Mike
>
>
>
>
>


--

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@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Teneo] - Howto copy EMF model from one database to another one [message #1039120 is a reply to message #1037384] Thu, 11 April 2013 19:43 Go to previous messageGo to next message
J. Michael Dean, M.D. is currently offline J. Michael Dean, M.D.Friend
Messages: 218
Registered: July 2009
Senior Member
On 4/9/13 7:39 AM, Martin Taal wrote:
> Hi Mike,
> No my proposal was not to change the generated code. It was all adding
> annotations to ecore.
>
> The GenericGenerator annotation can be be added to the epackage using an
> eannotation there. For the @Id and @GeneratedValue annotations these can
> be added/set in the eattribute, the @MappedSuperclass can be set on the
> EClass. The @Entity annotation is not needed, teneo will generate it.
>
> I am sure that you found the wiki documents on setting annotations in
> ecore:
> http://wiki.eclipse.org/Teneo/Hibernate#Model_Relational_Mapping_with_EJB3.2FJPA_Annotations
>
>
> And on another approach, if you like to have your annotations in the
> java code you can also try the texo project which tries to combine the
> best of both worlds, EMF and standard java/JPA:
> http://wiki.eclipse.org/Texo
>
> gr. Martin
>
>>>
>>>
>> I am trying to move an old Hibernate project into EMF and have a
>> related issue. The original code includes the
>> following snippets:
>>
>> ==================================================================
>> @MappedSuperclass
>> @org.hibernate.annotations.GenericGenerator(name="hibernate-uuid",
>> strategy = "uuid")
>> public class BaseEntity implements Identifiable {
>>
>> private String id;
>> private int version;
>> protected Boolean valid = true;
>>
>> public BaseEntity() {
>> this.valid = true;
>> }
>>
>> @Id
>> @GeneratedValue(generator="hibernate-uuid")
>> public String getId() {
>> return id;
>> }
>>
>> @Entity
>> @org.hibernate.annotations.GenericGenerator(name="hibernate-uuid",
>> strategy = "uuid")
>> public class Patient extends ModelObject{
>> etc.
>> }
>> ==================================================================
>>
>> I am unclear how these annotations should be added to an eCore model
>> in which I am allowing EMF to automatically
>> generate the e_id, etc. for different objects. The name and strategy
>> that I have shown above results in errors that
>> they are not recognized.
>>
>> Unfortunately my knowledge of EMF is struggling up the steep part of
>> the learning curve; I interpret your advice to
>> Phillipe to mean to hand edit the generated code, but I am interested
>> in getting as much as possible into the eCore
>> model itself.
>>
>> Thanks for thinking about this.
>>
>> - Mike

Thanks for your response. I think I have annotated things correctly,
but the generated classes do not have annotations in the implementation
files, and the interface files don't seem right. I am undoubtedly doing
something ridiculous. When the code is generated and I exercise it with
an adaptation of your Quickstart.java tutorial application, the
hibernate mapping file is generated but does not indicate anything about
a uuid generator, etc. I also receive an exception that ids for this
class must be manually assigned before calling save() - this error
occurs when the hibernate session is committed.

My model is actually simple, so I am attaching it to this post, hoping
you might see something obviously wrong. The only place I have an ID is
in the Person class that is at the top; I have indicated the annotation
source as teneo.jpa, and called the key "body" and the value the text of
the annotation. I have also attached the console output and the
Quickstart.java code.

I understand if you do not have time to open the model, but again if you
get a chance, I appreciate your help!

- Mike


Apr 11, 2013 1:09:21 PM org.eclipse.emf.teneo.hibernate.HbHelper createRegisterDataStore
INFO: Creating emf data store and registering it under name: Glucose
Apr 11, 2013 1:09:21 PM org.eclipse.emf.teneo.hibernate.HbHelper createRegisterDataStore
INFO: Returning created emf data store, initialize this newly created data store!
Apr 11, 2013 1:09:21 PM org.eclipse.emf.teneo.classloader.ClassLoaderResolver setClassLoaderStrategy
INFO: Class loader strategy set to: org.eclipse.emf.teneo.classloader.ContextClassLoaderStrategy
Apr 11, 2013 1:09:22 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Apr 11, 2013 1:09:22 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.1}
Apr 11, 2013 1:09:22 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Apr 11, 2013 1:09:22 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Apr 11, 2013 1:09:22 PM org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore setDefaultProperties
INFO: Hibernate property: hibernate.hbm2ddl.auto not set, setting to update
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: hibernate.connection.url: jdbc:mysql://127.0.0.1:3306/glucose
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.default_varchar_length: -1
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.set_default_cascade_on_non_containment:
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.default_id_feature: e_id
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.auditing.jointable.postfix: Auditing
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.auditing.prune.commit.interval: 1000
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.cascade_policy_on_non_containment: REFRESH,PERSIST,MERGE
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.always_version: true
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: e_container_column: e_container
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.fetch_one_to_many_extra_lazy: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.sql_discriminator_version_immutable_eclass: true
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.runtime.update_schema: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.runtime.handle_unset_as_null: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.version_column: e_version
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.set_proxy: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.discriminator_column_name: DTYPE
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.auditing.enable: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.disable_econtainer: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.sql_column_name_prefix:
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.auto_adapt_manual_set_sql_names: true
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.set_entity_automatically: true
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.join_column_naming_strategy: unique
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.set_foreign_key_name: true
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.set_generated_value_on_id_feature: true
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.auditing.prune.days: 0
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.emap_as_true_map: true
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.id_feature_as_primary_key: true
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: e_container_feature_name_column: e_container_feature_name
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: hibernate.connection.password: root
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.UserTimeType: org.eclipse.emf.teneo.hibernate.mapping.XSDDateTime
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.UserDateTimeType: org.eclipse.emf.teneo.hibernate.mapping.XSDDateTime
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.hibernate_mapping_file: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.UserDateType: org.eclipse.emf.teneo.hibernate.mapping.XSDDate
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.add_index_for_fk: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.map_all_lists_as_idbag: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: hibernate.connection.username: root
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.idbag_id_column_name: ID
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.ignore_eannotations: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.econtainer_feature_persistence_strategy: FEATURENAME
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.strategy: lowercase
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.join_table_naming_strategy: unique
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: hibernate.hbm2ddl.auto: update
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.XSDDateClass: javax.xml.datatype.XMLGregorianCalendar
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.sql_index_name_prefix:
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.extra_annotation_sources:
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: hibernate.connection.driver_class: com.mysql.jdbc.Driver
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.sql_fk_name_prefix:
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: hibernate.dialect: org.hibernate.dialect.MySQL5InnoDBDialect
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.map_document_root: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.max_comment_length: 0
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.max_sql_name_length: -1
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.default_id_column: e_id
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.always_map_list_as_bag: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.force_lazy: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.also_map_as_class: true
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.default_temporal: TIMESTAMP
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.auditing.entity.prefix:
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: econtainer_class_column: econtainer_class
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.persistence_xml.parse.lenient: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.fetch_containment_eagerly: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.map_embeddable_as_embedded: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.sql_name_escape_character: `
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.eav_mapping: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.optimistic_locking: true
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.cascade_all_on_containment:
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.sql_table_name_prefix:
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.runtime.convert_unset_to_null: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.cascade_policy_on_containment: ALL
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.default_cache_strategy: NONE
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.auditing.database.schema:
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.featuremap_as_component: false
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.naming.auditing.entity.postfix: Auditing
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.join_table_for_non_contained_associations: true
Apr 11, 2013 1:09:22 PM org.eclipse.emf.teneo.hibernate.HbDataStore logProperties
INFO: teneo.mapping.auto_add_referenced_epackages: false
Apr 11, 2013 1:09:22 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
Apr 11, 2013 1:09:22 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
Apr 11, 2013 1:09:22 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
Apr 11, 2013 1:09:22 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://127.0.0.1:3306/glucose]
Apr 11, 2013 1:09:22 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=root, password=****}
Apr 11, 2013 1:09:22 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
Apr 11, 2013 1:09:22 PM org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
Apr 11, 2013 1:09:22 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
Apr 11, 2013 1:09:22 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
Apr 11, 2013 1:09:22 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000228: Running hbm2ddl schema update
Apr 11, 2013 1:09:22 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000102: Fetching database metadata
Apr 11, 2013 1:09:22 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000396: Updating schema
Apr 11, 2013 1:09:22 PM org.hibernate.tool.hbm2ddl.DatabaseMetadata getTableMetadata
INFO: HHH000262: Table not found: clinicaldecision
Apr 11, 2013 1:09:22 PM org.hibernate.tool.hbm2ddl.DatabaseMetadata getTableMetadata
INFO: HHH000262: Table not found: intensivecareunit
Apr 11, 2013 1:09:22 PM org.hibernate.tool.hbm2ddl.DatabaseMetadata getTableMetadata
INFO: HHH000262: Table not found: person
Apr 11, 2013 1:09:22 PM org.hibernate.tool.hbm2ddl.DatabaseMetadata getTableMetadata
INFO: HHH000262: Table not found: clinicaldecision
Apr 11, 2013 1:09:22 PM org.hibernate.tool.hbm2ddl.DatabaseMetadata getTableMetadata
INFO: HHH000262: Table not found: intensivecareunit
Apr 11, 2013 1:09:22 PM org.hibernate.tool.hbm2ddl.DatabaseMetadata getTableMetadata
INFO: HHH000262: Table not found: person
Apr 11, 2013 1:09:22 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000232: Schema update complete
<?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="glucose.impl.PersonImpl" entity-name="Person" abstract="false" lazy="false" discriminator-value="Person" table="`person`">
<meta attribute="eclassName" inherit="false">Person</meta>
<meta attribute="epackage" inherit="false">http://edu/utah/cdmcc/glucose</meta>
<id name="personID" type="java.lang.String">
<column not-null="true" unique="false" name="`personid`"/>
</id>
<discriminator type="string">
<column name="`dtype`" index="persondtype" 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="lastName" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`lastname`"/>
</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>
</class>
<subclass name="glucose.impl.PatientImpl" entity-name="Patient" abstract="false" lazy="false" extends="Person" discriminator-value="Patient">
<meta attribute="eclassName" inherit="false">Patient</meta>
<meta attribute="epackage" inherit="false">http://edu/utah/cdmcc/glucose</meta>
<property name="weight" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.Double">
<column not-null="false" unique="false" name="`weight`"/>
</property>
<property name="medRecNum" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`medrecnum`"/>
</property>
<property name="studyID" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`studyid`"/>
</property>
<property name="birthdate" lazy="false" insert="true" update="true" not-null="false" unique="false" type="calendar">
<column not-null="false" unique="false" name="`birthdate`"/>
</property>
<property name="height" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.Double">
<column not-null="false" unique="false" name="`height`"/>
</property>
<property name="status" lazy="false" not-null="false" insert="true" update="true" unique="false">
<column not-null="false" unique="false" name="`status`"/>
<type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType">
<param name="enumClass">glucose.StatusType</param>
<param name="eclassifier">StatusType</param>
<param name="epackage">http://edu/utah/cdmcc/glucose</param>
</type>
</property>
<list name="decisions" lazy="true" cascade="all,delete-orphan">
<key foreign-key="patient_decisions_key" update="true">
<column name="`patient_decisions_personid`" unique="false"/>
</key>
<list-index column="`patient_decisions_idx`"/>
<one-to-many entity-name="GlucoseDecision"/>
</list>
<many-to-one name="createdBy" entity-name="User" lazy="false" cascade="merge,persist,save-update,lock,refresh" foreign-key="patient_createdby" insert="true" update="true" not-null="false">
<column not-null="false" unique="false" name="`user_createdby_personid`"/>
</many-to-one>
</subclass>
<subclass name="glucose.impl.UserImpl" entity-name="User" abstract="false" lazy="false" extends="Person" discriminator-value="User">
<meta attribute="eclassName" inherit="false">User</meta>
<meta attribute="epackage" inherit="false">http://edu/utah/cdmcc/glucose</meta>
<property name="accountRights" lazy="false" not-null="false" insert="true" update="true" unique="false">
<column not-null="false" unique="false" name="`accountrights`"/>
<type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType">
<param name="enumClass">glucose.AccessType</param>
<param name="eclassifier">AccessType</param>
<param name="epackage">http://edu/utah/cdmcc/glucose</param>
</type>
</property>
<property name="accountName" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`accountname`"/>
</property>
<property name="passwordDigest" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`passworddigest`"/>
</property>
<many-to-one name="createdBy" entity-name="User" lazy="false" cascade="merge,persist,save-update,lock,refresh" foreign-key="user_createdby" insert="true" update="true" not-null="false">
<column not-null="false" unique="false" name="`user_createdby_personid`"/>
</many-to-one>
</subclass>
<class name="glucose.impl.ClinicalDecisionImpl" entity-name="ClinicalDecision" abstract="false" lazy="false" discriminator-value="ClinicalDecision" table="`clinicaldecision`">
<meta attribute="eclassName" inherit="false">ClinicalDecision</meta>
<meta attribute="epackage" inherit="false">http://edu/utah/cdmcc/glucose</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="clinicaldecisiondtype" 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="decisionTimeStamp" lazy="false" insert="true" update="true" not-null="false" unique="false" type="calendar">
<column not-null="false" unique="false" name="`decisiontimestamp`"/>
</property>
<property name="observationDate" lazy="false" insert="true" update="true" not-null="false" unique="false" type="calendar">
<column not-null="false" unique="false" name="`observationdate`"/>
</property>
<property name="patientWeight" lazy="false" insert="true" update="true" not-null="false" unique="false" type="double">
<column not-null="false" unique="false" name="`patientweight`"/>
</property>
<property name="patientHeight" lazy="false" insert="true" update="true" not-null="false" unique="false" type="double">
<column not-null="false" unique="false" name="`patientheight`"/>
</property>
<property name="patientAgeDays" lazy="false" insert="true" update="true" not-null="false" unique="false" type="int">
<column not-null="false" unique="false" name="`patientagedays`"/>
</property>
<property name="adviceText" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`advicetext`"/>
</property>
<property name="rulesFiredText" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`rulesfiredtext`"/>
</property>
<property name="rationaleText" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`rationaletext`"/>
</property>
<property name="declineComment" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`declinecomment`"/>
</property>
<property name="acceptComment" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`acceptcomment`"/>
</property>
<property name="otherComment" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`othercomment`"/>
</property>
<property name="userAction" lazy="false" not-null="false" insert="true" update="true" unique="false">
<column not-null="false" unique="false" name="`useraction`"/>
<type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType">
<param name="enumClass">glucose.UserActionType</param>
<param name="eclassifier">UserActionType</param>
<param name="epackage">http://edu/utah/cdmcc/glucose</param>
</type>
</property>
<property name="minutesToNextEvaluation" lazy="false" insert="true" update="true" not-null="false" unique="false" type="int">
<column not-null="false" unique="false" name="`minutestonextevaluation`"/>
</property>
<many-to-one name="createdBy" entity-name="User" lazy="false" cascade="merge,persist,save-update,lock,refresh" foreign-key="clinicaldecision_createdby" insert="true" update="true" not-null="false">
<column not-null="false" unique="false" name="`user_createdby_personid`"/>
</many-to-one>
</class>
<subclass name="glucose.impl.GlucoseDecisionImpl" entity-name="GlucoseDecision" abstract="false" lazy="false" extends="ClinicalDecision" discriminator-value="GlucoseDecision">
<meta attribute="eclassName" inherit="false">GlucoseDecision</meta>
<meta attribute="epackage" inherit="false">http://edu/utah/cdmcc/glucose</meta>
<property name="previousGlucoseConcentration" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.Integer">
<column not-null="false" unique="false" name="`previousglucoseconcentration`"/>
</property>
<property name="previousObservationTime" lazy="false" insert="true" update="true" not-null="false" unique="false" type="calendar">
<column not-null="false" unique="false" name="`previousobservationtime`"/>
</property>
<property name="serumGlucoseConcentration" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.Integer">
<column not-null="false" unique="false" name="`serumglucoseconcentration`"/>
</property>
<property name="currentInsulinDripRate" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.Double">
<column not-null="false" unique="false" name="`currentinsulindriprate`"/>
</property>
<property name="carbohydrateStatus" lazy="false" not-null="false" insert="true" update="true" unique="false">
<column not-null="false" unique="false" name="`carbohydratestatus`"/>
<type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType">
<param name="enumClass">glucose.CarbohydrateStatusType</param>
<param name="eclassifier">CarbohydrateStatusType</param>
<param name="epackage">http://edu/utah/cdmcc/glucose</param>
</type>
</property>
<property name="recommendedInsulinDripRate" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.Double">
<column not-null="false" unique="false" name="`recommendedinsulindriprate`"/>
</property>
<property name="recommendedInsulinBolus" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.Double">
<column not-null="false" unique="false" name="`recommendedinsulinbolus`"/>
</property>
<property name="recommendedGlucoseBolus" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.Double">
<column not-null="false" unique="false" name="`recommendedglucosebolus`"/>
</property>
<property name="insulinMode" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`insulinmode`"/>
</property>
</subclass>
<class name="glucose.impl.IntensiveCareUnitImpl" entity-name="IntensiveCareUnit" abstract="false" lazy="false" discriminator-value="IntensiveCareUnit" table="`intensivecareunit`">
<meta attribute="eclassName" inherit="false">IntensiveCareUnit</meta>
<meta attribute="epackage" inherit="false">http://edu/utah/cdmcc/glucose</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="intensivecareunitdtype" 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>
<list name="patients" lazy="true" cascade="all,delete-orphan">
<key foreign-key="intensivecareunit_patients_key" update="true">
<column name="`intensivecareunit_patients_e_id`" unique="false"/>
</key>
<list-index column="`intensivecareunit_patients_idx`"/>
<one-to-many entity-name="Patient"/>
</list>
<list name="users" lazy="true" cascade="all,delete-orphan">
<key foreign-key="intensivecareunit_users_key" update="true">
<column name="`intensivecareunit_users_e_id`" unique="false"/>
</key>
<list-index column="`intensivecareunit_users_idx`"/>
<one-to-many entity-name="User"/>
</list>
</class>
</hibernate-mapping>
Exception in thread "main" org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): Person
at org.hibernate.id.Assigned.generate(Assigned.java:52)
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:118)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:204)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:189)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:114)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90)
at org.hibernate.internal.SessionImpl.fireSaveOrUpdate(SessionImpl.java:641)
at org.hibernate.internal.SessionImpl.saveOrUpdate(SessionImpl.java:633)
at org.hibernate.engine.spi.CascadingAction$5.cascade(CascadingAction.java:259)
at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:380)
at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:323)
at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:208)
at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:409)
at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:350)
at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:326)
at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:208)
at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:165)
at org.hibernate.event.internal.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:160)
at org.hibernate.event.internal.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:151)
at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:88)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1127)
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:325)
at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
at examples.QuickStart.doQuickStart(QuickStart.java:155)
at examples.QuickStart.main(QuickStart.java:56)/**
* <copyright>
*
* Copyright (c) 2010 Springsite BV (The Netherlands) and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Martin Taal
* </copyright>
*
* $Id: QuickStart.java,v 1.7 2010/11/11 10:28:15 mtaal Exp $
*
* Adapted by J. Michael Dean for gluose insulin model 2013/03/27
*/

package examples;

import glucose.AccessType;
import glucose.CarbohydrateStatusType;
import glucose.GlucoseDecision;
import glucose.GlucoseFactory;
import glucose.GlucosePackage;
import glucose.IntensiveCareUnit;
import glucose.Patient;
import glucose.StatusType;
import glucose.User;
import java.util.Calendar;
import java.util.Properties;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.teneo.PersistenceOptions;
import org.eclipse.emf.teneo.hibernate.HbDataStore;
import org.eclipse.emf.teneo.hibernate.HbHelper;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Environment;


/**
* Quick Start Tutorial for the <a href="http://wiki.eclipse.org/Teneo">Teneo</a> project.
*
* @author <a href="mailto:mtaal@xxxxxxxx">Martin Taal</a>
* @version $Revision: 1.7 $
*/
public class QuickStart {


/** The main method */
public static void main(String[] args) {
// the name of the database, this database should exist but does not
// need to contain tables
String dbName = "glucose";
doQuickStart(dbName); // ignore return
}

/**
* The method performing the real action. This method is used by other tutorials therefore has it
* been made public and expects the database name and returns an instance of the HbDataStore.
*/
public static HbDataStore doQuickStart(String dbName) {

// The hibernate properties can be set by having a hibernate.properties
// file in the root of
// the classpath.
// Another approach is setting the properties in the HbDataStore.
// For more information see section 3.1 of the Hibernate manual
final Properties props = new Properties();
props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
props.setProperty(Environment.USER, "root");
props.setProperty(Environment.URL, "jdbc:mysql://127.0.0.1:3306/" +
dbName);
props.setProperty(Environment.PASS, "root");
props.setProperty(Environment.DIALECT,
org.hibernate.dialect.MySQL5InnoDBDialect.class.getName());

// props.setProperty(Environment.DRIVER, "org.hsqldb.jdbcDriver");
// props.setProperty(Environment.USER, "sa");
// props.setProperty(Environment.URL, "jdbc:hsqldb:mem:library");
// props.setProperty(Environment.PASS, "");
// props.setProperty(Environment.DIALECT, org.hibernate.dialect.HSQLDialect.class.getName());

// set a specific option
// see this page
// http://wiki.eclipse.org/Teneo/Hibernate/Configuration_Options
// for all the available options
props
.setProperty(PersistenceOptions.CASCADE_POLICY_ON_NON_CONTAINMENT, "REFRESH,PERSIST,MERGE");

// the name of the session factory
String hbName = "Glucose";
// create the HbDataStore using the name
final HbDataStore hbds = HbHelper.INSTANCE.createRegisterDataStore(hbName);

// set the properties
hbds.setDataStoreProperties(props);

// sets its epackages stored in this datastore
hbds.setEPackages(new EPackage[] { GlucosePackage.eINSTANCE });

// initialize, also creates the database tables
try {
hbds.initialize();
} finally {
// print the generated mapping
System.err.println(hbds.getMappingXML());
}

SessionFactory sessionFactory = hbds.getSessionFactory();

// Create a session and a transaction
Session session = sessionFactory.openSession();
Transaction tx = session.getTransaction();

// Start a transaction, create a library and make it persistent
tx.begin();
IntensiveCareUnit picu = GlucoseFactory.eINSTANCE.createIntensiveCareUnit();
session.save(picu);

// create a user
User user = GlucoseFactory.eINSTANCE.createUser();
user.setAccountName("mdean");
user.setAccountRights(AccessType.NORMAL);
user.setFirstName("Michael");
user.setLastName("Dean");

//picu.getUsers().add(user);
//session.save(user);

Patient patient = GlucoseFactory.eINSTANCE.createPatient();
//patient.setBirthdate(new GregorianCalendar());
patient.setBirthdate(Calendar.getInstance());

patient.setCreatedBy(user);
patient.setFirstName("Sally Jo");
patient.setLastName("Zuspan");
patient.setHeight(150.);
patient.setWeight(57.6);
patient.setMedRecNum("12-34-56");
patient.setStatus(StatusType.CURRENT);
patient.setStudyID("CHOM0003");

//session.save(patient);


GlucoseDecision decision = GlucoseFactory.eINSTANCE.createGlucoseDecision();
decision.setCreatedBy(user);
decision.setCarbohydrateStatus(CarbohydrateStatusType.UNCHANGED);

// add the user and patient to the intensive care unit
picu.getPatients().add(patient);
picu.getUsers().add(user);

// at commit the objects will be present in the database
tx.commit();
// and close of, this should actually be done in a finally block
session.close();

return hbds;
}
}
Re: [Teneo] - Howto copy EMF model from one database to another one [message #1039201 is a reply to message #1039120] Thu, 11 April 2013 22:32 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Mike,
Ok, np, I will try to spend some time on this over the weekend..

gr. Martin

On 04/11/2013 09:43 PM, J. Michael Dean wrote:
> On 4/9/13 7:39 AM, Martin Taal wrote:
>> Hi Mike,
>> No my proposal was not to change the generated code. It was all adding
>> annotations to ecore.
>>
>> The GenericGenerator annotation can be be added to the epackage using an
>> eannotation there. For the @Id and @GeneratedValue annotations these can
>> be added/set in the eattribute, the @MappedSuperclass can be set on the
>> EClass. The @Entity annotation is not needed, teneo will generate it.
>>
>> I am sure that you found the wiki documents on setting annotations in
>> ecore:
>> http://wiki.eclipse.org/Teneo/Hibernate#Model_Relational_Mapping_with_EJB3.2FJPA_Annotations
>>
>>
>> And on another approach, if you like to have your annotations in the
>> java code you can also try the texo project which tries to combine the
>> best of both worlds, EMF and standard java/JPA:
>> http://wiki.eclipse.org/Texo
>>
>> gr. Martin
>>
>>>>
>>>>
>>> I am trying to move an old Hibernate project into EMF and have a
>>> related issue. The original code includes the
>>> following snippets:
>>>
>>> ==================================================================
>>> @MappedSuperclass
>>> @org.hibernate.annotations.GenericGenerator(name="hibernate-uuid",
>>> strategy = "uuid")
>>> public class BaseEntity implements Identifiable {
>>>
>>> private String id;
>>> private int version;
>>> protected Boolean valid = true;
>>>
>>> public BaseEntity() {
>>> this.valid = true;
>>> }
>>>
>>> @Id
>>> @GeneratedValue(generator="hibernate-uuid")
>>> public String getId() {
>>> return id;
>>> }
>>>
>>> @Entity
>>> @org.hibernate.annotations.GenericGenerator(name="hibernate-uuid",
>>> strategy = "uuid")
>>> public class Patient extends ModelObject{
>>> etc.
>>> }
>>> ==================================================================
>>>
>>> I am unclear how these annotations should be added to an eCore model
>>> in which I am allowing EMF to automatically
>>> generate the e_id, etc. for different objects. The name and strategy
>>> that I have shown above results in errors that
>>> they are not recognized.
>>>
>>> Unfortunately my knowledge of EMF is struggling up the steep part of
>>> the learning curve; I interpret your advice to
>>> Phillipe to mean to hand edit the generated code, but I am interested
>>> in getting as much as possible into the eCore
>>> model itself.
>>>
>>> Thanks for thinking about this.
>>>
>>> - Mike
>
> Thanks for your response. I think I have annotated things correctly, but the generated classes do not have annotations
> in the implementation files, and the interface files don't seem right. I am undoubtedly doing something ridiculous. When
> the code is generated and I exercise it with an adaptation of your Quickstart.java tutorial application, the hibernate
> mapping file is generated but does not indicate anything about a uuid generator, etc. I also receive an exception that
> ids for this class must be manually assigned before calling save() - this error occurs when the hibernate session is
> committed.
>
> My model is actually simple, so I am attaching it to this post, hoping you might see something obviously wrong. The
> only place I have an ID is in the Person class that is at the top; I have indicated the annotation source as teneo.jpa,
> and called the key "body" and the value the text of the annotation. I have also attached the console output and the
> Quickstart.java code.
>
> I understand if you do not have time to open the model, but again if you get a chance, I appreciate your help!
>
> - Mike
>


--

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@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Teneo] - Howto copy EMF model from one database to another one [message #1040396 is a reply to message #1039201] Sat, 13 April 2013 14:02 Go to previous message
J. Michael Dean, M.D. is currently offline J. Michael Dean, M.D.Friend
Messages: 218
Registered: July 2009
Senior Member
On 4/11/13 4:32 PM, Martin Taal wrote:
> Hi Mike,
> Ok, np, I will try to spend some time on this over the weekend..
>
> gr. Martin
>

>
>
Martin - Thank you for your kindness. I finally found out the problem
and will just jot the details here in case someone else needs the
information. I was annotating the package and the ID field with
teneo.jpa as the source, when it should have been teneo.hibernate. I
was also not marking the key as appinfo. I found one of your examples
(id.ecore) which led the way to solving the solution.

- Mike
Previous Topic:Edapt issues when ecores extend one another
Next Topic:Equality, hashcodes, EMF and Hibernate
Goto Forum:
  


Current Time: Fri Mar 29 11:08:37 GMT 2024

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

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

Back to the top