Please use the google group to ask questions - thanks.

by Esowah 09 Dec 10:07
Simple trivial unidirectional mapping is not working

I have a user class looking like this:

@Entity
public class User{
@Id
private Long id;
@Column(name = "FIRST_NAME")
private String firstName;

@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name="GROUP_ID")
private Set groups = new HashSet();

//... and all the other getters and setters
}
@Entity
public class Group{

@Id
private Long id;
private String name;

//.. and many others plus their getters and setters
}

When I try to fill a user and add some groups, and then persist I get the following exception:

java.lang.RuntimeException: Null Getter for: com.company.rcde.entity.annotation.Group.RCDE_USER.

It seems like it is expecting a User to be defined and mapped in the Group class which is not what I want to achieve. I need just a unidirectional oneToMany mapping.

It is very frustrating such a simple mapping is not working. Or am I doing something wrong here?

I have to add that I'm not a newbie here. I have done several Hibernate-annotations mapping in the past.

16 Dec 01:30
by Rob

Do you have the stack trace?

I can't see anything in the example that would relate to "RCDE_USER" so perhaps if you can post up the entire example that would help too.

Thanks, Rob.

16 Dec 01:32
by Rob

Can I get you to post up the entire example?

I can't see where the "RCDE_USER" is coming from or what it is so I think it would be good to see the entire thing.

Also, if you have the stack trace that is always good to post up.

Thanks, Rob.

Create a New Topic

Title:
Body:
 
Introduction User Guide (pdf) Install/Configure Public JavaDoc Whitepapers
General Database Specific Byte Code Deployment Annotations Features
Top Bugs Top Enhancements
woResponse