Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » HBM file generation by teneo
HBM file generation by teneo [message #104268] Wed, 05 December 2007 14:02 Go to next message
justin Mising name is currently offline justin Mising nameFriend
Messages: 28
Registered: July 2009
Junior Member
Hi ,

Iam using teneo 0.7.5 with EMF 2.2.
I have library ecore file.
Elver Doc says that we can generate hbm file by right-clicking ecore file.
I have teneo.hibernate and all the hibernate libraries in dependancy tab
of plugin.xml.
When i try generating hbm file from ecore file,i get blank hbm file.

The doc says to register datasource the foll way:
final String dataStoreName = "LibraryDataStore";
final HbDataStore dataStore =
HbHelper.INSTANCE.createRegisterDataStore(dataStoreName);

// To configure Hibernate, supply properties describing the JDBC driver,
// URL, username/password and SQL dialect.
// By default the properties are obtained from the file
// "hibernate.properties" at the classpath root.
// Configure the EPackages persisted by this DataStore.
dataStore.setEPackages(new EPackage[] {EcorePackage.eINSTANCE,
XMLTypePackage.eINSTANCE});

dataStore.initialize();

Should i run the above piece of code and then right-click to generate hbm
file.
Kindly let me know the sequence of steps for hbm file generation from
ecore at the earliest possible.
Thanks,
Justin.
Re: HBM file generation by teneo [message #104294 is a reply to message #104268] Wed, 05 December 2007 18:13 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Justin,
Is your ecore file in the same project as the generated model sources?

You can also programmatically generate the hbm file through the HbHelper.generateMapping method.
Note that to persist your objects you don't need to generate the hbm file separately, Teneo will do
that for you when you initialize the datastore (as you describe below). You can view the in-memory
hbm by calling the dataStore.getMappingXML method.

gr. Martin

Justin wrote:
> Hi ,
>
> Iam using teneo 0.7.5 with EMF 2.2.
> I have library ecore file.
> Elver Doc says that we can generate hbm file by right-clicking ecore file.
> I have teneo.hibernate and all the hibernate libraries in dependancy
> tab of plugin.xml.
> When i try generating hbm file from ecore file,i get blank hbm file.
>
> The doc says to register datasource the foll way:
> final String dataStoreName = "LibraryDataStore";
> final HbDataStore dataStore =
> HbHelper.INSTANCE.createRegisterDataStore(dataStoreName);
>
> // To configure Hibernate, supply properties describing the JDBC
> driver,
> // URL, username/password and SQL dialect.
> // By default the properties are obtained from the file
> // "hibernate.properties" at the classpath root.
> // Configure the EPackages persisted by this DataStore.
> dataStore.setEPackages(new EPackage[] {EcorePackage.eINSTANCE,
> XMLTypePackage.eINSTANCE});
>
> dataStore.initialize();
>
> Should i run the above piece of code and then right-click to generate
> hbm file.
> Kindly let me know the sequence of steps for hbm file generation from
> ecore at the earliest possible.
> Thanks,
> Justin.
>
>


--

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: HBM file generation by teneo [message #104328 is a reply to message #104294] Thu, 06 December 2007 12:46 Go to previous messageGo to next message
justin Mising name is currently offline justin Mising nameFriend
Messages: 28
Registered: July 2009
Junior Member
Hi Martin ,

Thanks a lot for your quick answer.
Teneo is now working in my machine.
I could see dynamic hbm.xml file also.

Best regards,
Justin.
Re: HBM file generation by teneo [message #105393 is a reply to message #104294] Thu, 27 December 2007 13:58 Go to previous messageGo to next message
justin Mising name is currently offline justin Mising nameFriend
Messages: 28
Registered: July 2009
Junior Member
Hi Martin,
When domain model class is persisted through Teneo 0.75,it creates
E_ID,E_Version columns to the new table created for entity domain class.
If this is not needed if customer didn't want it,is there a way to bypass
these extra column creations.Teneo is not being accepted sue to this in my
project.Pls let me know asap.
Thanks,
Justin.
Re: HBM file generation by teneo [message #105443 is a reply to message #105393] Thu, 27 December 2007 14:29 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Justin,
These columns are created if there is no explicit id and version attribute identified in the model.

A number of things which you can try:

You can control the name of the automatically created id and version control columns through the
PersistenceOptions.VERSION_COLUMN_NAME and PersistenceOptions.ID_COLUMN_NAME options.

If you have explicit eattributes for id and version in the model then you can tag these using the
@Id and @Version annotation. Teneo will then not create e_id or e_version columns.

You can disable the automatic creation of the version column by setting the option:
PersistenceOptions.ALWAYS_VERSION to "false".

gr. Martin

Justin wrote:
> Hi Martin,
> When domain model class is persisted through Teneo 0.75,it creates
> E_ID,E_Version columns to the new table created for entity domain class.
> If this is not needed if customer didn't want it,is there a way to
> bypass these extra column creations.Teneo is not being accepted sue to
> this in my project.Pls let me know asap.
> Thanks,
> Justin.
>


--

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: HBM file generation by teneo [message #105521 is a reply to message #105443] Mon, 31 December 2007 12:24 Go to previous messageGo to next message
justin Mising name is currently offline justin Mising nameFriend
Messages: 28
Registered: July 2009
Junior Member
Hi Martin ,
Thanks for your reply.
The mail says:
You can disable the automatic creation of the version column by setting
the option: PersistenceOptions.ALWAYS_VERSION to "false".
WHere Do I need to set this option .Is it In code or genmodel editor.
It doesn't seem to be there in genmodel editor.
If it is in code,it didn't allow as PersistenceOptions.ALWAYS_VERSION is
final variable when it is called in standalone class.
Pls let me know asap.
Regards,
Justin
Re: HBM file generation by teneo [message #105528 is a reply to message #105521] Mon, 31 December 2007 12:39 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Justin,
To set options you have to generate the hbm programmatically. This is not very difficult. Just
create a class (in your model project) with a main static method and from there call
HbHelper.generateMapping. This method returns a string with the hbm. The method expects two
parameters, one the set of epackages, the other a properties object. To disable versioning set this
in the properties object (props) you pass to the method:
props.setProperty(PersistenceOptions.ALWAYS_VERSION, "false");

gr. Martin

justin wrote:
> Hi Martin ,
> Thanks for your reply.
> The mail says:
> You can disable the automatic creation of the version column by setting
> the option: PersistenceOptions.ALWAYS_VERSION to "false".
> WHere Do I need to set this option .Is it In code or genmodel editor.
> It doesn't seem to be there in genmodel editor.
> If it is in code,it didn't allow as PersistenceOptions.ALWAYS_VERSION is
> final variable when it is called in standalone class.
> Pls let me know asap.
> Regards,
> Justin
>




--

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: HBM file generation by teneo [message #612755 is a reply to message #104268] Wed, 05 December 2007 18:13 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Justin,
Is your ecore file in the same project as the generated model sources?

You can also programmatically generate the hbm file through the HbHelper.generateMapping method.
Note that to persist your objects you don't need to generate the hbm file separately, Teneo will do
that for you when you initialize the datastore (as you describe below). You can view the in-memory
hbm by calling the dataStore.getMappingXML method.

gr. Martin

Justin wrote:
> Hi ,
>
> Iam using teneo 0.7.5 with EMF 2.2.
> I have library ecore file.
> Elver Doc says that we can generate hbm file by right-clicking ecore file.
> I have teneo.hibernate and all the hibernate libraries in dependancy
> tab of plugin.xml.
> When i try generating hbm file from ecore file,i get blank hbm file.
>
> The doc says to register datasource the foll way:
> final String dataStoreName = "LibraryDataStore";
> final HbDataStore dataStore =
> HbHelper.INSTANCE.createRegisterDataStore(dataStoreName);
>
> // To configure Hibernate, supply properties describing the JDBC
> driver,
> // URL, username/password and SQL dialect.
> // By default the properties are obtained from the file
> // "hibernate.properties" at the classpath root.
> // Configure the EPackages persisted by this DataStore.
> dataStore.setEPackages(new EPackage[] {EcorePackage.eINSTANCE,
> XMLTypePackage.eINSTANCE});
>
> dataStore.initialize();
>
> Should i run the above piece of code and then right-click to generate
> hbm file.
> Kindly let me know the sequence of steps for hbm file generation from
> ecore at the earliest possible.
> Thanks,
> Justin.
>
>


--

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: HBM file generation by teneo [message #612759 is a reply to message #104294] Thu, 06 December 2007 12:46 Go to previous message
justin Mising name is currently offline justin Mising nameFriend
Messages: 28
Registered: July 2009
Junior Member
Hi Martin ,

Thanks a lot for your quick answer.
Teneo is now working in my machine.
I could see dynamic hbm.xml file also.

Best regards,
Justin.
Re: HBM file generation by teneo [message #613032 is a reply to message #104294] Thu, 27 December 2007 13:58 Go to previous message
justin Mising name is currently offline justin Mising nameFriend
Messages: 28
Registered: July 2009
Junior Member
Hi Martin,
When domain model class is persisted through Teneo 0.75,it creates
E_ID,E_Version columns to the new table created for entity domain class.
If this is not needed if customer didn't want it,is there a way to bypass
these extra column creations.Teneo is not being accepted sue to this in my
project.Pls let me know asap.
Thanks,
Justin.
Re: HBM file generation by teneo [message #613037 is a reply to message #105393] Thu, 27 December 2007 14:29 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Justin,
These columns are created if there is no explicit id and version attribute identified in the model.

A number of things which you can try:

You can control the name of the automatically created id and version control columns through the
PersistenceOptions.VERSION_COLUMN_NAME and PersistenceOptions.ID_COLUMN_NAME options.

If you have explicit eattributes for id and version in the model then you can tag these using the
@Id and @Version annotation. Teneo will then not create e_id or e_version columns.

You can disable the automatic creation of the version column by setting the option:
PersistenceOptions.ALWAYS_VERSION to "false".

gr. Martin

Justin wrote:
> Hi Martin,
> When domain model class is persisted through Teneo 0.75,it creates
> E_ID,E_Version columns to the new table created for entity domain class.
> If this is not needed if customer didn't want it,is there a way to
> bypass these extra column creations.Teneo is not being accepted sue to
> this in my project.Pls let me know asap.
> Thanks,
> Justin.
>


--

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: HBM file generation by teneo [message #613048 is a reply to message #105443] Mon, 31 December 2007 12:24 Go to previous message
justin Mising name is currently offline justin Mising nameFriend
Messages: 28
Registered: July 2009
Junior Member
Hi Martin ,
Thanks for your reply.
The mail says:
You can disable the automatic creation of the version column by setting
the option: PersistenceOptions.ALWAYS_VERSION to "false".
WHere Do I need to set this option .Is it In code or genmodel editor.
It doesn't seem to be there in genmodel editor.
If it is in code,it didn't allow as PersistenceOptions.ALWAYS_VERSION is
final variable when it is called in standalone class.
Pls let me know asap.
Regards,
Justin
Re: HBM file generation by teneo [message #613049 is a reply to message #105521] Mon, 31 December 2007 12:39 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Justin,
To set options you have to generate the hbm programmatically. This is not very difficult. Just
create a class (in your model project) with a main static method and from there call
HbHelper.generateMapping. This method returns a string with the hbm. The method expects two
parameters, one the set of epackages, the other a properties object. To disable versioning set this
in the properties object (props) you pass to the method:
props.setProperty(PersistenceOptions.ALWAYS_VERSION, "false");

gr. Martin

justin wrote:
> Hi Martin ,
> Thanks for your reply.
> The mail says:
> You can disable the automatic creation of the version column by setting
> the option: PersistenceOptions.ALWAYS_VERSION to "false".
> WHere Do I need to set this option .Is it In code or genmodel editor.
> It doesn't seem to be there in genmodel editor.
> If it is in code,it didn't allow as PersistenceOptions.ALWAYS_VERSION is
> final variable when it is called in standalone class.
> Pls let me know asap.
> Regards,
> Justin
>




--

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:[Search] OCLExpressionWidget needs addModifyListener method?
Next Topic:[CDO] Connection failures
Goto Forum:
  


Current Time: Sat Apr 20 06:14:42 GMT 2024

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

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

Back to the top