Reputation: 4435
in my yaml definition, an object doesn't get connected. It is null. I don't see the problem:
Person:
@Entity
@Table(name="person")
public class Person extends Model {
@Id
@Constraints.Required
@Formats.NonEmpty
public Long id;
...
LifeCycleEvent:
@Entity
@Table(name="lifecycleevent")
public class LifeCycleEvent extends Model {
@Id
@Constraints.Required
@Formats.NonEmpty
public Integer id;
@ManyToOne
@Constraints.Required
public Person author;
init-data.yml
lifecycleevent:
- !!models.LifeCycleEvent
title: Lorem Away 1
text: Lorem ipsum dolor sit amet, consectetuer a ...
read: 1
creationDateTime: 2010-02-11 11:02:57
publishingDateTime: 2012-01-12 07:30:00
lastEditedDateTime: 2013-03-23 15:22:00
author: !!models.Person
id: 1
The test
LifeCycleEvent lifeCycleEvent = LifeCycleEvent.findById(1);
assertThat(lifeCycleEvent).isNotNull();
assertThat(lifeCycleEvent.id).isEqualTo(1);
assertThat(lifeCycleEvent.author).overridingErrorMessage("Author of " + lifeCycleEvent + " can not be null").isNotNull();
Upvotes: 1
Views: 225
Reputation: 4435
The problem was that (of course) the order of the Ebean.save() in the global-settings matters
Upvotes: 1