Please use the google group to ask questions - thanks.

by sr 23 Oct 23:44
Derived primary key

I am not quite sure how to get this to work. I have a primary key whose value is derived from a ManyToOne relation:

@ManyToOne
@JoinColumn(name = "job_schedule_id", referencedColumnName = "id")
@Constraints.Required
private JobSchedule jobSchedule;

That is, the value of my primary key is essentially jobSchedule.getId(). Since this is an enhanced bean, I can't use a getter annotated with @Id. However, I also can't annotate the above ManyToOne with @Id. Otherwise, ebean attempts to persist the contents of JobSchedule in place of the primary key.

Any ideas? If not, I am going to attempt to turn off enhancement for this bean and use subclassing...

Thanks,

stan

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