-->
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: MappingException: Could not determine type for java.util.Set
PostPosted: Mon Dec 22, 2008 8:16 pm 
Regular
Regular

Joined: Sun Sep 25, 2005 11:35 pm
Posts: 57
I am getting the following exception when trying to map a set of embeddable types into an entity:

Code:
org.hibernate.MappingException: Could not determine type for: java.util.Set, for columns: [org.hibernate.mapping.Column(accountParties)]
        at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
        at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
        at org.hibernate.mapping.Property.isValid(Property.java:185)
        at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:440)
        at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
        at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)

My entity looks like this:

Code:
@Entity
public class Account implements Serializable {
    ...
    private Set<AccountParty> accountParties =
        new HashSet<AccountParty>();

    @CollectionOfElements(targetElement = AccountParty.class)
    @JoinTable(name="Account_AccountParties")
    public Set<AccountParty> getAccountParties() {
        return accountParties;
    }

    public void setAccountParties(Set<AccountParty> accountParties) {
        this.accountParties = accountParties;
    }
}

As you can see, I have put @CollectionOfElements on the getter method of accountParties. Also I have specified the set as Set<AccountParty>. So why is hibernate not able to determine the type for java.util.Set? My embeddable class looks like this:

Code:
@Embeddable
public class AccountParty implements Serializable {
    private Party party;

    @ManyToOne(targetEntity=Party.class)
    public Party getParty() {
        return party;
    }

    public void setParty(Party party) {
        this.party = party;
    }
}

Any help would be much appreciated?

Thanks.
Naresh


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 22, 2008 9:55 pm 
Regular
Regular

Joined: Sun Sep 25, 2005 11:35 pm
Posts: 57
It appears that the problem was due to hibernate-annotations.jar slipping into my ear file. As soon as I removed this from my ear (relying on the version provided by JBoss), the problem went away!

Naresh


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.