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)