Recently I discovered ActiveObejcts and I really like it. Right now I'm using the last version from Atlassian plugin, only the net.java.ao
part for ORM. Compiles and runs fine. Sure, I have to do some performance tests, if it fits my requirements.
There exists the @Implementation annotation. How is that used? The javadocs are very brief.
Update
Solution:
public class M5 {
public static void main(String[] args) throws SQLException {
EntityManager m = EntityManagerBuilder
.url("jdbc:hsqldb:./db/db")
.username("root")
.password("")
.c3po()
.build();
m.migrate(Employee.class);
Employee p = m.create(Employee.class);
p.setFirstName("Peter");
p.setLastName("Mmm");
System.err.println(p.getLastName()); // prints "ln: Mmm"
p.save();
}
}
public class Emp {
private Employee employee;
public Emp(Employee employee) {
this.employee = employee;
}
public String getLastName() {
return "ln: " + employee.getLastName();
}
}
@Implementation(Emp.class)
interface Employee extends Entity {
String getFirstName();
void setFirstName(String name);
String getLastName();
void setLastName(String name);
}
}