mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
FIX for ManyToOne targetType & OSGI MANIFEST
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.avaje.tests.basic;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.tests.model.basic.ResetBasicData;
|
||||
import com.avaje.tests.model.interfaces.Address;
|
||||
import com.avaje.tests.model.interfaces.IAddress;
|
||||
import com.avaje.tests.model.interfaces.IPerson;
|
||||
import com.avaje.tests.model.interfaces.Person;
|
||||
|
||||
public class TestManyOneInterface extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
IAddress a = new Address();
|
||||
|
||||
IPerson p = new Person();
|
||||
|
||||
p.setDefaultAddress(a);
|
||||
|
||||
Ebean.save(a);
|
||||
Ebean.save(p);
|
||||
|
||||
//Assert.assertTrue();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.avaje.tests.model.interfaces;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Version;
|
||||
|
||||
@Entity
|
||||
public class Address implements IAddress {
|
||||
|
||||
@Id
|
||||
private long oid;
|
||||
|
||||
@Version
|
||||
private int version;
|
||||
|
||||
private String street;
|
||||
|
||||
public long getOid() {
|
||||
return oid;
|
||||
}
|
||||
|
||||
public void setOid(long oid) {
|
||||
this.oid = oid;
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStreet() {
|
||||
return street;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStreet(String s) {
|
||||
this.street = s;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.avaje.tests.model.interfaces;
|
||||
|
||||
public interface IAddress {
|
||||
public String getStreet();
|
||||
public void setStreet(String s);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.avaje.tests.model.interfaces;
|
||||
|
||||
public interface IPerson {
|
||||
public IAddress getDefaultAddress();
|
||||
public void setDefaultAddress(IAddress address);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.avaje.tests.model.interfaces;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Version;
|
||||
|
||||
@Entity
|
||||
public class Person implements IPerson {
|
||||
@Id
|
||||
private long oid;
|
||||
|
||||
@Version
|
||||
private int version;
|
||||
|
||||
@ManyToOne(targetEntity=Address.class)
|
||||
private IAddress defaultAddress;
|
||||
|
||||
@Override
|
||||
public IAddress getDefaultAddress() {
|
||||
return defaultAddress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaultAddress(IAddress address) {
|
||||
this.defaultAddress = address;
|
||||
}
|
||||
|
||||
public long getOid() {
|
||||
return oid;
|
||||
}
|
||||
|
||||
public void setOid(long oid) {
|
||||
this.oid = oid;
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user