-->
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 Configurations - Composite Keys!!!!
PostPosted: Wed Jan 24, 2007 10:47 am 
Newbie

Joined: Wed Jan 24, 2007 9:23 am
Posts: 5
Location: London, W2
Wow this is a headache! Simple really, what I want to do is to be able to execute HQL queries in Eclipse. Seems like an easy task, yes?

MiddlegenTask executes to create a lovely set of mapping files with composite keys resolved with entries such as...


Code:
    <composite-id name="comp_id" class="uk.co.billabong.pojo.CurrencyRatePK">
        <meta attribute="field-description" inherit="false">
           @hibernate.id
            generator-class="assigned"
        </meta>
        <key-property
            name="sourceCode"
            column="source_code"
            type="java.lang.String"
            length="4"
        >
            <meta attribute="field-description">
               @hibernate.property
                column="source_code"
                length="4"
            </meta>
        </key-property>
        <key-property
            name="destinationCode"
            column="destination_code"
            type="java.lang.String"
            length="4"
        >
            <meta attribute="field-description">
               @hibernate.property
                column="destination_code"
                length="4"
            </meta>
        </key-property>
    </composite-id>


Running hbm2java wonderfully translates these mapping files into pojos whiole creating composite key classes, as required.

I then setup the hibernate.cfg.xml document ok but when I attempt to create a hibernate configuration I get a...

Quote:
Sessionfactory error: component class not found: uk.co.billabong.pojo.CurrencyRatePK


caused by a

Quote:
ClassNotFoundException: uk.co.billabong.pojo.CurrencyRatePK


I am assuming HC uses the Eclipse classpath where it should quite happily locate said classes! I have also included the pojo location in the HC setup but to no avail. With this error I am unable to perform any queries and my head hurts with all this bangin on wall!

Why is HC unable to locate this composite key class???? Is it hiding? Has it nipped out for lunch???? Seriously though, I'm baffled. I have scoured the internet for help but it seems there is no-one else on this planet with the same problem (well there might be but they're probably hiding as well!!!).


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 24, 2007 12:18 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you haven't searched very long then ;)

before hibernate 3.2.0.beta9 you had to setup a classpath on the console configuration...that is documented and written about many many times.

But with hibernate 3.2.0.beta9 we pick up the project chosen for the console configuration to be used....and that should definitly work.

So...what version of hibernate tools are you actually using...and why are you using middlegen to generate mapping files ? :)

_________________
Max
Don't forget to rate


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.