facebook

Hibernate reverse engineering

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #245771 Reply

    toriwells
    Member

    Hi 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.

    #245772 Reply

    Riyad Kalla
    Member

    if 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.

    #245804 Reply

    snpe
    Member

    Ramon,

    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 this

    #245806 Reply

    Riyad Kalla
    Member

    I 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.

    #245808 Reply

    KIG
    Participant

    Before 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,
    Klaus

    #245830 Reply

    RT04
    Member

    I’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
    RT04

    #245834 Reply

    Riyad Kalla
    Member

    RT04 are you referring to Hibernate Annotation docs?

    #245837 Reply

    RT04
    Member

    Riyad, That is correct. I’m referring to Hiberanate annotated code.

    #245840 Reply

    snpe
    Member

    when 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 MyEclipse

    #245842 Reply

    snpe
    Member

    when you make annotation configuration, you need make annotation configuration

    when you make annotation POJO, you need …

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: Hibernate reverse engineering

You must be logged in to post in the forum log in