-->
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.  [ 1 post ] 
Author Message
 Post subject: ManyToMany weird property-ref
PostPosted: Tue Sep 15, 2009 6:30 pm 
Newbie

Joined: Mon Oct 09, 2006 4:54 pm
Posts: 1
Location: Dallas, Texas, United States
I'm using JPA with Hibernate 3.2.1 sp1 to establish a ManyToMany relationship between two entities (in the package com.elite.ehms.model) using a Join Table I hand-crafted:
Code:
@Entity
@Table(name="outreach_queues")
public class Queue implements Serializable
{
    @ManyToMany(fetch=FetchType.LAZY, cascade={CascadeType.ALL})
    @JoinTable(
        name="outreach_queues_employer",
        joinColumns=@JoinColumn(name="queueId", referencedColumnName="queueId"),
        inverseJoinColumns=@JoinColumn(name="employerId", referencedColumnName="employerId")
    )
    public Set<Employer> getEmployers() {...}

    ...
}

@Entity
@Table(name="employer")
public class Employer implements Serializable
{
    @ManyToMany(mappedBy="employers", fetch=FetchType.LAZY)
    public List<Queue> getQueues() {...}

    ...
}

CREATE TABLE `outreach_queues_employer` (
  `queueemployerId` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `queueId` BIGINT UNSIGNED NOT NULL,
  `employerId` BIGINT UNSIGNED NOT NULL,
  PRIMARY KEY (`queueemployerId`),
  CONSTRAINT `FK_employerId` FOREIGN KEY `FK_employerId` (`employerId`)
    REFERENCES `employer` (`employerId`)
    ON DELETE CASCADE
    ON UPDATE CASCADE,
  CONSTRAINT `FK_queueId` FOREIGN KEY `FK_queueId` (`queueId`)
    REFERENCES `outreach_queues` (`queueId`)
    ON DELETE CASCADE
    ON UPDATE CASCADE
);

The deploy exception I get is: org.hibernate.MappingException: property-ref [_com_elite_ehms_model_Queue_employers] not found on entity [com.elite.ehms.model.Queue]

Why is the property-ref prefixing the FQCN of the parent entity to the name of the mappedBy property? It also prefixes an underscore and converts the dots to underscores.


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

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.