#1804 - Kotlin: Generating collection with wildcard type - Get error BeanNotRegisteredException: Error with association to [null] from [...Foo.manyProperty]. Is null registered?

This commit is contained in:
rob bygrave
2019-08-25 15:58:46 +12:00
parent be66872249
commit 0e65efea57
4 changed files with 153 additions and 1 deletions
@@ -0,0 +1,60 @@
package org.tests.o2m;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Version;
import java.util.List;
import static javax.persistence.CascadeType.ALL;
@Entity
public class OmBasicParent {
@Id
private long id;
private final String name;
@Version
private long version;
/**
* Not really sensible Java code here but Kotlin can generate
* a collection type that looks like this
*/
@OneToMany(cascade = ALL, mappedBy = "parent")
private List<? extends OmBasicChild> children;
public OmBasicParent(String name) {
this.name = name;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public long getVersion() {
return version;
}
public void setVersion(long version) {
this.version = version;
}
public List<? extends OmBasicChild> getChildren() {
return children;
}
public void setChildren(List<? extends OmBasicChild> children) {
this.children = children;
}
}