facebook

Inconvenient naming of variable in mapping

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

    kudo
    Member

    Hi!

    I’m a relatively new user of MyEclipse and I’m absolutely in love with it! Though, in all relationships there are some things you don’t understand 😉

    To the point… When trying to create hibernate mapping the name of many-to-one mappings is a bit inconvenient. Instead of a name similar or equal to the name of the table column the name is set to the referred table type. Since there doesn’t seem to be any way to manually edit the mapping file and then recreate the java-files (I searched the forums and came up with this answer…) this becomes a bit annoying. Is there any way to get better naems of these names or will I have to manually edit the names and recreate the java-files with an other plugin/tool?

    Info about my env:
    OS: FreeBSD 4.11
    JDK: 1.4.2
    Eclipse: 3.0.1
    MyEclipse: 3.8.4
    DBMS: PostgreSQL 7.4.5
    Hibernate version: Supplied with MyEclipse (I think…)

    Here’s my test case:

    
    create table dude (id serial primary key, name text not null);
    
    create table ball (id serial primary key, ball_size integer not null, owner integer not null references dude, creator integer not null references dude);
    

    “Create Hibernate Mapping” from the DB Explorer gives the following mapping:

    
        <class name="Ball" table="ball">
            <id name="id" column="id" type="integer">
                <generator class="native"/>
            </id>
     
            <property name="ballSize" column="ball_size" type="integer"  not-null="true" />
     
            <many-to-one name="dude" column="owner" class="Dude"  not-null="true" />
     
            <many-to-one name="dude1" column="creator" class="Dude"  not-null="true" />
        </class>
    

    As you can see the naming is a bit inconvenient, to say the least… Is there any way around this or will I have manage this some other way than with ME?

    Thanks in advance,
    Patrik Kudo

    #225855 Reply

    Riyad Kalla
    Member

    I’m a relatively new user of MyEclipse and I’m absolutely in love with it!

    We are really glad to hear that, this is the reason we do what we do!

    Is there any way to get better naems of these names or will I have to manually edit the names and recreate the java-files with an other plugin/tool?

    Unfortunately not right now, however our hibernate support is far from done. The version of Hibernate tools you are using now is our *first* release of Hibernate support, not too bad for a first release IMO. For the next 2 or 3 releases we are going to add more functionality and more tweaking that the user will be allowed to handle, one of them (IIRC) is naming the generated fields.

    We appologize for the inconvenience right now, if you absolutely need this functionality Joe Hudson has created and excellent Hibernate plugin called “Hibernate Synchronizer” that *might* do what you want, I haven’t used it before.

    #225866 Reply

    kudo
    Member

    Hi and thanks for your response!

    Unfortunately not right now, however our hibernate support is far from done. The version of Hibernate tools you are using now is our *first* release of Hibernate support, not too bad for a first release IMO. For the next 2 or 3 releases we are going to add more functionality and more tweaking that the user will be allowed to handle, one of them (IIRC) is naming the generated fields.

    From browsing the forum I gathered that the hibernate support is still young and I was afraid I’d get this reply.

    We appologize for the inconvenience right now, if you absolutely need this functionality Joe Hudson has created and excellent Hibernate plugin called “Hibernate Synchronizer” that *might* do what you want, I haven’t used it before.

    I actually downloaded and tried Hibernate Synchronizer (HS) earlier today and it seems to work fine in cooperation with the manually edited mapping files generated by ME. However, the files generated by the HS suffer from a bit more bloat than I’ll be needing and the code your plugin generates are so much nicer, I’d rather use a refined version of yours.

    When is a release with extended Hibernate support planed? If it’s too far away I’ll have to figure out a solution with HS or something similar, but if it’s closer to now I can probably wait.

    Regards,
    Patrik

    #225886 Reply

    support-jeff
    Member

    Patrik –

    No ETA at this early date, but we are actively working on it. Will be this year, definitely.

    BTW, you can alter the generated files all you want. Just beware that if you re-gen the files, your changes will be overwritten. Alternately, you can customize things in the stubbed out subclasses. So for example, if you wanted get/setOwner rather than get/setDude in your example above, just add get/setOwner to the empty subclass of AbstractBall (should be called Ball) that call through to the get/setDude methods as appropriate. I know it is less convenient, but it is a workaround.

    jeff

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Inconvenient naming of variable in mapping

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