public class Person {
public String getName() { ... }
@UiComesAfter( "name" )
public Set<Address> getAddresses() { ... }
}
public String getName() { ... }
@UiComesAfter( "name" )
public Set<Address> getAddresses() { ... }
}
...into...
public class Person {
public String getName() { ... }
@UiComesAfter( Person_.name )
public Set<Address> getAddresses() { ... }
}
public String getName() { ... }
@UiComesAfter( Person_.name )
public Set<Address> getAddresses() { ... }
}
But today I realised it has another cool side effect. I can refactor...
public class Person {
public String getName() { ... }
@UiComesAfter( Person_.name )
@OneToMany( mappedBy = "person" )
public Set<Address> getAddresses() { ... }
}
public String getName() { ... }
@UiComesAfter( Person_.name )
@OneToMany( mappedBy = "person" )
public Set<Address> getAddresses() { ... }
}
...into...
public class Person {
public String getName() { ... }
@UiComesAfter( Person_.name )
@OneToMany( mappedBy = Address_.person )
public Set<Address> getAddresses() { ... }
}
public String getName() { ... }
@UiComesAfter( Person_.name )
@OneToMany( mappedBy = Address_.person )
public Set<Address> getAddresses() { ... }
}
...giving me more typesafe (well, typo-safe :) JPA2 annotations! The existing JPA2 metamodel, being designed mainly for Criteria queries, doesn't seem to support this yet. But I don't see why it couldn't be added for a future release?
Comments welcome!
0 comments:
Post a Comment