facebook

How to update abstract class after change to *.hbm.xml?

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

    Hello,

    I’ve just installed Eclipse 3.1 with MyEclipse 4.0m2. I’ve successfully created a hibernate mapping (except that no “id” element was created; I guess ME couldn’t figure out the PKs).

    Now, I’ve added the missing elements and renamed a couple of fields. How do I generate the abstract class again? Just saving the XML doesn’t work 😕

    Thanks.

    #232005 Reply

    Riyad Kalla
    Member

    Go back to the DB explorer, right click on your table and “Generate Hibernate Mapping”, keep in mind that it will overwrite the Abstract class as well as the mapping file, so backup your changes inthe mapping file if you made them.

    #232076 Reply

    I don’t want to overwrite the mapping file after I just fixed it.

    How do I create the abstract class from the mapping file?

    #232099 Reply

    Specifically, I guess that ME first generates the mapping file and then runs some Java code to convert the XML into Java classes. Is there a way to run this second step manually?

    For example, by creating a Launch config in Eclipse in which I add lots of external JARs from the MQ install. In which class is this code?

    I could then do this myself and post the results.

    #232103 Reply

    Riyad Kalla
    Member

    Aaron,
    I’m sorry at this time we don’t support this level of control over the mapping generation process.

    #232240 Reply

    Riyad,

    Will this be in ME 4.0? I think this is a must-have because the generation process works so unreliably when it comes to primary keys and pk generators.

    Regards.

    #232259 Reply

    Riyad Kalla
    Member

    Aaron,
    We made some improvements to the automaic mappings, but the big “fix” is going to come in the form of a visual mapping editor where you can visually drag and drop the relationships between tables before the mappings are generated. That didn’t make the 4.0 cut becasue our users demanded Hibernate 3 support instead, so the visual editor will make a later release, but it should help you with the situation you are having.

    I’m sorry for the trouble in the mean time.

    #232386 Reply

    Riyad,

    This editor sounds great but I think that a “regenerate file” button in the MyEclipse menu for all *.hbm.xml files would just take a couple of hours to implement and ease the situation until the editor becomes available.

    As it is, the whole hibernate functionality of ME is useless for me, so I would like to ask you to file a bug on my behalf that needs to be fixed for 4.0 final.

    Thanks,

    #232391 Reply

    Riyad Kalla
    Member

    Aaron, I think that is a good idea, I’ll file that enhancement request.

    #232867 Reply

    Finch
    Member

    I have a different but “similar” question: (ME 4.0 M2)
    1) What’s an easy way of updating (checking) all hbm.xml and my classes after changes to the database? I mean… of course I can “create hibernate mapping” again, but it doesn’t even remember where I put the files/classes last time. Doesn’t really seem very practical for a large number of tables!!
    2) (How) can I define relations which are not defined in the database and have them survive an update?

    Thanks 🙂

    #232880 Reply

    Riyad Kalla
    Member

    Finch,
    These more advanced issues are to be addressed in a future release with our visual relationship editor, it won’t make the 4.0 release as Hibernate 3 support (by user demand) was more important, but it is comming.

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: How to update abstract class after change to *.hbm.xml?

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