-->
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: one-to-one bidirectional via Xdoclet
PostPosted: Tue Mar 16, 2004 5:35 am 
Beginner
Beginner

Joined: Wed Mar 03, 2004 6:02 am
Posts: 46
Location: Kuala Lumpur, Malaysia
Following up on this thread, I can't seem to the correct one-to-one mapping via hibernatedoclet: The error I got:

Quote:
net.sf.hibernate.MappingException: could not instantiate id generator
at net.sf.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:82)
at net.sf.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:80)
at net.sf.hibernate.cfg.Configuration.iterateGenerators(Configuration.java:413)
at net.sf.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:461)
at net.sf.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:58)
at net.sf.hibernate.tool.hbm2ddl.SchemaExport.main(SchemaExport.java:297)
Caused by: net.sf.hibernate.MappingException:
param named "property" is required for foreign id generation strategy
at net.sf.hibernate.id.ForeignGenerator.configure(ForeignGenerator.java:64)


Excerpt from the xdoclet tags between class Foo and Bar:
Code:
public class Foo {

    /**
     * @hibernate.id
     *      unsaved-value="null"
     *      generator-class="native"
     * @return Long
     */
    public Long getId() {
        return id;
    }   

    /**
     * @hibernate.one-to-one
     *      class = "org.babi.Bar"
     *      cascade = "save-update"
     */
    public Bar getBar() {
        return bar;
    }
    ---o<--snip----
}

public class Bar {
    /**
     * @hibernate.id
     *      unsaved-value="null"
     *      generator-class="foreign"
     *
     */
    public Long getId() {
        return id;
    }

    /**
     * @hibernate.one-to-one
     *      class = "org.babi.Foo"
     *      constrained = "true"
     */
    public Foo getFoo() {
        return foo;
    }
    ---o<--snip----
}



What is the mistake ? Thanks.

Regards,

alistair


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 10:23 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
http://xdoclet.sourceforge.net/tags/hibernate-tags.html#@hibernate.generator-param%20(0..*)

_________________
Emmanuel


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.