Hi, I'm trying to follow exactly the example in the hibernate book "Java Persistence with Hibernate", Chapter 7, Section 7.2.3, p. 307 -> "Mapping the Join table to a Collection of components".
I have a value class called FooBar, that is a link between a Foo and a Bar, and contains an extra column of information.
It's like this:
Code:
@Embeddable
@org.hibernate.annotations.AccessType("field")
public class FooBar {
@org.hibernate.annotations.Parent
private Foo foo;
@ManyToOne
@JoinColumn(name = "BAR_ID", nullable=false, updatable=false)
private Bar bar;
@Column(name="EXTRA_STUFF")
private String stuff;
...etc.
}
Then in the Foo class (which is an Entity class), I have this:
Code:
@org.hibernate.annotations.CollectionOfElements
@JoinTable(name="FOO_ID", joinColumns=@JoinColumn(name="BAR_ID")
private Set<FooBar> fooBars;
This is *exactly* how the book describes it, but when I try to load this in hibernate-tools in eclipse, I get a SessionFactory error that complains that:
Quote:
org.hibernate.PropertyNotFoundException: Could not find a setter for property foo in class com.blah.FooBar
I explicitly set the AccessType to "field", so why isn't this working? I don't want to add setter methods...as this class should be immutable anyway.