These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate and hbm2java with JDK 1.5 generics?
PostPosted: Thu Feb 05, 2004 3:41 pm 
Expert
Expert

Joined: Thu Jan 08, 2004 6:17 pm
Posts: 278
Not sure which forum to post this in, so I'll post it here....

So, is there any idea from anyone whether or when hbm2java will get suppot for the new generics in JDK 1.5 (now publicly out in beta)?

I don't know quite what it would look like -- and it'll be a pain getting the syntax right in mapping files -- but maybe something like:

Code:
    <class name="com.nimblefish.core.data.Client">

        <id name="id" type="long" unsaved-value="null" >
            <generator class="native"/>
        </id>

        <property name="name" type="string"/>

        <set name="campaigns" inverse="true" cascade="all-delete-orphan">
            <key column="client_id"/>
            <one-to-many class="com.nimblefish.core.data.Campaign"/>
        </set>
    </class>


resulting in:

Code:
/** @author Hibernate CodeGenerator */
public class Client implements Serializable {

    /** identifier field */
    private Long id;

    /** nullable persistent field */
    private String name;

    /** persistent field */
    private Set<Campaign> campaigns;

    /** full constructor */
    public Client(String name, Set<Campaign> campaigns) {
        this.name = name;
        this.campaigns = campaigns;
    }

    /** default constructor */
    public Client() {
    }

    /** minimal constructor */
    public Client(Set<Campaign> campaigns) {
        this.campaigns = campaigns;
    }


etc.?????

I know, I know, you'd love to get patches through JIRA :-) Hmm... maybe that'd be a fun project to work on... add some kind of meta attribute="generate-generics" or something?

Has anyone been thinking about and/or working on this yet? And would there be issues in getting the Hibernate runtime to play nicely with generics?

Cheers!
Rob


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 05, 2004 3:46 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Well, the Hibernate core will need to support generics first ;)

This is on the TODO list. The biggest problem is keeping back-compatibility.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.