facebook

Hibernate code generation – ID object?

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

    Rick Geneva
    Member

    Version: 3.2.0
    Build id: M20060629-1905

    BRING BACK THE OLD HIBERNATE MAPPING PLEASE!!!! Or at least have it as an option.

    Why do all of the new Hibernate code generators make me create an ID object for every single bean I want to map? I mean, read the Hibernate website and where does it tell you that you must do that? How is this useful and why would I want to bother with it? This used to be a fairly straightforward process of mapping a POJO to a database table and now I have at least 4 files for everything I do. It’s so cluttered that I have a hard time navigating my project with all of these useless files. I’m so frustrated with it that I’m seriously considering going back to the older version of myeclipse. I pay for myeclipse to get the ‘goodies’ but for this particular ‘feature’ I can actually write the code and map it myself faster than what it takes to go back and clean up all the junk that was autogenerated. It appears that my only alternative is to create my own custom mapping template. The help files still show the previous version’s hibernate mapping wizard which is useless because the screen doesn’t even look the same anymore. So a custom template it is. I wish I would have known this before I payed another fifty bucks for renewal.

    #256017 Reply

    Haris Peco
    Member

    rickgn,

    We will update templates zip and documentation for MyEclipse 5.0 (it will be released next week).We can’t revert to old mappings, because it is much enhanced.You have to have ID (identifier) for every hibernate object (and every ORM tool at all), because it is only way that hibernate know identity of object.You have separate classes for ID if your primary keys are composite keys (PK with more columns).However, you will have templates and can make own mappings

    Thanks

    #256050 Reply

    Rick Geneva
    Member

    Ok. I see your point on the ID object. Just to clarify my point, as an experienced developer I like my tools/IDE to ask me, remind me, etc. instead of going ahead and doing something that I did not want it to do. For example, if the little lightbulb next to an error in the main java editor would just do stuff for me instead of putting a lightbulb there I would never use the tool again. My suggestion would be to put a warning along with an explanation of what is about to happen when you have more than one key or the PK is missing.

    Thank you for your quick response, and sorry about my grumpy attitude yesterday.

    #256061 Reply

    Haris Peco
    Member

    rickgn ,

    It’s problem that hibernate support bad tables without PK (and view for example) and bettter (but no complete good) composite Id.It isn’t blame for hibernate – it is very hard for resolving in some ORM tools – nobody do better

    Thanks

    #256161 Reply

    Theo Briscoe
    Member

    On solution is to allow the developer to select the primary key from the lost of table columns. The functionality is avilable in IMB’s Rational Application Developer.

    #259157 Reply

    Intax
    Member

    Hello, I have problem with this functionality. I have two tables – table_name and table_name_id. When I generate the Hibernate mapping for these tables, there is a name collision (class TableNameId and AbstractTableNameId). One of the tables “wins” – so finally I am missing two classes. MyEclipse doesn’t generate any warning about such situation. I tried to specify a different class name for one of the tables, but the value I entered is ignored.

    Version: 5.0.1 GA
    Build id: 20060810-5.0.1-GA

    Thanks
    Pavel

    #260129 Reply

    Intax
    Member

    Hello, no response?

    Pavel

    #260205 Reply

    Haris Peco
    Member

    Pavel,

    When you specify a different class name you have to specify full class name, for example
    com.yourpackage.YourClass
    If you specify only YourClass class is created in default package

    Regards,
    Peco

    #260221 Reply

    Brian Fernandes
    Moderator

    Pavel,

    In addition to what Peco mentioned above, please also read the following post in case you are running into a bug that was recently discovered in this area:
    https://www.genuitec.com/forums/topic/a-small-request-for-hibernate-spring-reverse-engineering/#post-260220

    Do let us know how it turns out or if you need further clarification,
    Brian.

    #260326 Reply

    bragelonne
    Member

    hi guys,

    i’m new to this forum and Hibernate. I’m having this topic’s opposite problem: i would like to force code generation of a ID class for a table which has a single primary key. Is that possible? (i understand that it’s not a very logical solution, but i have no control over the application’s architecture).

    Thank you for your support.

    #260366 Reply

    Intax
    Member

    Hi,

    I think it IS the same problem as in the thread you mentioned – i wrote a comment there.
    Anyway, I would expect the wizzard to notify me there is a class name collision.

    Thanks
    Pavel

    #260384 Reply

    bragelonne
    Member

    If I understand correctly, rickgn’s problem was that he didn’t want to have automatic id classes generated for every table that has composite key. My problem is that I would like to have id classes created not only for tables with composite primary keys, but also for the tables with a single column primary key. Anybody know if there’s an option for that?

Viewing 12 posts - 1 through 12 (of 12 total)
Reply To: Hibernate code generation – ID object?

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