facebook

Hibernate reverse engineering and generics

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

    Hi,
    When generating code with Hibernate reverse engineering the generated code shows a lot of generics related warnings. For example the following is a mapping file snippet

    
            <set name="audioformats" inverse="true">
                <key>
                    <column name="formatid" precision="9" scale="0" />
                </key>
                <one-to-many class="com.test.hibernate.AudioAsset" />
            </set>
    

    This generates a property definition in the class as follows

    
         private Set audioformats = new HashSet(0);
    

    instead of

    
         private Set<AudioFormat>  audioformats  = new HashSet<AudioFormat>(0);
    

    I get similar generics related warnings at other places.

    Thanks & Regards,
    Aniruddh

    #295172 Reply

    Brian Fernandes
    Moderator

    Aniruddh,

    We do generate generic code (like typed collections) if you use Hibernate 3.2 with annotations instead of mapping files. There is no UI control which will turn on generic generation for other cases. Please let us know if you need this feature.

    #295173 Reply

    Brian,
    Thanks for the reply. I will try code generation with annotations. It would be great to have generics based code generated for mapping files as well. This might be very be very helpful when migrating from Hibernate 2.x

    Regards,
    Aniruddh

    #322756 Reply

    Let me second this request for the ability to generate code using generic, even if not generating code with annotations. (Not sure if you already support it – we are still at MyEclipse 8.6, and it does not seem to be an option there…).

    Moises

    #322787 Reply

    support-swapna
    Moderator

    moilejter,

    Thank you for the request. We already have an enhancement request filed.
    The dev team is looking into it.

    #340115 Reply

    raydawg2000
    Participant

    is there any update to this feature for xml mapping files? This would be great to have. I have a couple regExps I run through eclipse to generate this stuff for me after the fact but its a pain and not always accurate! thanks

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Hibernate reverse engineering and generics

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