- This topic has 9 replies, 5 voices, and was last updated 19 years, 5 months ago by
snpe.
-
AuthorPosts
-
toriwellsMemberHi all,
first of all, I’m sorry if I’m asking something answered before. If so, I have not found it. Well, my question is if there’s any way to generate the *.hbm.xml files directly from the POJOs rather than the DB. I say so because I think the most correct way to create an application (take care this is a personal opinion) is first design it (at the abstract level -interfaces, classes and so on) and then look for the way to store all the information generated by the application. So, if there’s no way to do it by now, I think it would be a great feature for future releases.
Thanks all for your time.
Ramon M. Gallart
Software Engineer.January 31, 2006 at 1:41 pm #245772
Riyad KallaMemberif there’s any way to generate the *.hbm.xml files directly from the POJOs rather than the DB.
Not at the moment, but generation of the POJOs from the HBMs and visa-versa has been on our TODO list, sorry for the delay.
January 31, 2006 at 8:17 pm #245804
snpeMemberRamon,
if there’s any way to generate the *.hbm.xml files directly from the POJOs rather than the DB.
there isn’t unique mapping pojo to hbm
You can use xdoclet, but i think that you want annotations – hibernate annotations are beta now, but ejb3 specification is final and annotations will be final, soon
when use annotations then you needn’t hbm.xml – all is in java – you need jdk > 5.0 for thisJanuary 31, 2006 at 8:29 pm #245806
Riyad KallaMemberI would point out that annotations are insanely cool and even negate the creation of a DB in some cases (e.g. annotate your code and just run it, hib will create the DB structure necessary to persist the classes on the first run).
I’ve heard this but haven’t tried it first hand yet. Please check the hibernate docs for more info.
February 1, 2006 at 1:23 am #245808
KIGParticipantBefore I started a (mid size) Hibernate 2 project last year I faced the same question where and how to start. I decided to design everything in UML and wrote a generator, which created the hbm files. From that point I was able to use the Hibernate Tools to create the POJO’s and the database schema. As a review I would say that this approach worked very well for me because it gave me a maximum flexibility. On the other hand it’s some extra effort, which might be too cost extensive. Another drawback is that you’ve to adapt everything for following Hibernate versions.
Now I started evaluating the Hibernate Mapping from an existing database model. I thing this approach is always useful when you replace an existing application by using the same database.
How do the MyEclipse Team think about the development approach?
Regards,
KlausFebruary 1, 2006 at 10:33 am #245830
RT04MemberI’m not sure how to handle the following situations:
1. How can I generate the schema from annotated code? The quick start guide only talks about generating POJOs from schema. Is there any other documentation?
2. During development, the POJOs and schema are constantly out-of sync. How do I handle the situation without disturbing existing code?
Thanks
RT04February 1, 2006 at 10:56 am #245834
Riyad KallaMemberRT04 are you referring to Hibernate Annotation docs?
February 1, 2006 at 1:12 pm #245837
RT04MemberRiyad, That is correct. I’m referring to Hiberanate annotated code.
February 1, 2006 at 2:11 pm #245840
snpeMemberwhen you make annotation configuration, you need make annotation configuration (like HibernateUtil, just use AnnotationConfiguration) and you can make schema with SchemaExport class (SchemaExport class is part of hibernate, AnnotationConfiguration is part of hibernate annotations projects)
It possible make this step automatic in MyEclipseFebruary 1, 2006 at 2:12 pm #245842
snpeMemberwhen you make annotation configuration, you need make annotation configuration
when you make annotation POJO, you need …
-
AuthorPosts