-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Advanced reveng types?
PostPosted: Thu Jan 11, 2007 5:10 pm 
Newbie

Joined: Mon Jan 08, 2007 5:10 am
Posts: 11
Hibernate version:
JBoss Seam 1.1.0.GA

Due to many problems with MySQL quirks I wrote tool that can extract additional metadata and now I can generate nice reveng.xml. However, I don't know what is possible to define there.

Is it possible to define enums, including value list?

Is it possible to put parametrized types in reveng.xml?


Top
 Profile  
 
 Post subject: Re: Advanced reveng types?
PostPosted: Fri Jan 12, 2007 6:34 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
zeljko_t wrote:
Hibernate version:
JBoss Seam 1.1.0.GA

Due to many problems with MySQL quirks I wrote tool that can extract additional metadata and now I can generate nice reveng.xml. However, I don't know what is possible to define there.


what kind of "nice reveng.xml" ?

Quote:
Is it possible to define enums, including value list?


this does not sound reverse engineering related, but more a code generation issue right ?

Quote:
Is it possible to put parametrized types in reveng.xml?


not currently, but it is conceptually possible.

one way of doing it now is to typedef them in a hbm.xml and just use the typedefed ones in reveng.xml

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: Advanced reveng types?
PostPosted: Fri Jan 12, 2007 6:45 am 
Newbie

Joined: Mon Jan 08, 2007 5:10 am
Posts: 11
max wrote:
zeljko_t wrote:
Hibernate version:
JBoss Seam 1.1.0.GA

Due to many problems with MySQL quirks I wrote tool that can extract additional metadata and now I can generate nice reveng.xml. However, I don't know what is possible to define there.

what kind of "nice reveng.xml" ?

More metadata, but syntactically wrong :)
Quote:
Quote:
Is it possible to define enums, including value list?


this does not sound reverse engineering related, but more a code generation issue right ?

Code generation of annotated POJOs is kind of reverse engineering or am I wrong? They are not generated from mapping file, but rather from database structure?
Quote:
Quote:
Is it possible to put parametrized types in reveng.xml?


not currently, but it is conceptually possible.

one way of doing it now is to typedef them in a hbm.xml and just use the typedefed ones in reveng.xml

Sounds good. I'll try that. If I want to use this with JPA and JBoss, what's the common way to force Hibernate to load hbm.xml? I put it as orm.xml in the same directory as persistence.xml, but I am not sure is it the right way.


Top
 Profile  
 
 Post subject: Re: Advanced reveng types?
PostPosted: Fri Jan 12, 2007 7:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
zeljko_t wrote:
max wrote:
zeljko_t wrote:
Hibernate version:
JBoss Seam 1.1.0.GA

Due to many problems with MySQL quirks I wrote tool that can extract additional metadata and now I can generate nice reveng.xml. However, I don't know what is possible to define there.

what kind of "nice reveng.xml" ?

More metadata, but syntactically wrong :)
Quote:


did you just generate random content and hoped it would work ? :)

Quote:
Is it possible to define enums, including value list?


this does not sound reverse engineering related, but more a code generation issue right ?

Code generation of annotated POJOs is kind of reverse engineering or am I wrong? They are not generated from mapping file, but rather from database structure?
[/quote]

In context of how the tooling works then no ;)

What happens is that the reverse engineering part builds up a Hibernate Meta Model (essentially a org.hibernate.Configuration); just like reading hbm.xml or annotations would do - but here we are reading via jdbc metadata instead. That is the reverse engineering part (which is adjustable through reveng.xml)

The code generation part is done via templates/code based on a org.hibernate.Configuration hence it does not matter from which source we got the Configuration object.

So in your setup with respect to generating enums you probably are in a kinda "no mans land" since enums are not really available in a org.hibernate.Configuration (thus not reverse engineered per se) and we don't have any code generation templates for it ...so you would need some additonal work to do this.

One is to read some additonal metadata and the other is to make this available to your custom templates. Making sense until now ?

The question then becomes how we do this (if at all) in hibernate tools....i'm inclined to say it should at least be possible to do thus it would be great if you could create a jira issue about this that shows what needs to actually be reverse engineered and what the generated outcome(s) should be .....then it could be used as good usecase for adding this flexibility.

Quote:
Quote:
Is it possible to put parametrized types in reveng.xml?


not currently, but it is conceptually possible.

one way of doing it now is to typedef them in a hbm.xml and just use the typedefed ones in reveng.xml

Sounds good. I'll try that. If I want to use this with JPA and JBoss, what's the common way to force Hibernate to load hbm.xml? I put it as orm.xml in the same directory as persistence.xml, but I am not sure is it the right way.[/quote]

Hibernate JPA read's in any hbm.xml it finds in the persistence unit AFAIK; it should be documented pretty well in the docs. (there can be some issue about you having to force JPA to read your typedef.hbm.xml first to allow it to resolve them properly)

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.