So, how to create an EntityManager programmatically?
- Solution link: http://docs.jboss.org/hibernate/stable/entitymanager/reference/en/html/configuration.html
import javax.persistence.Column;
import javax.persistence.Entity;
@Entity
public class Person {
@Column(length=30)
private String firstName;
public static void main(String[] args) throws SecurityException, NoSuchFieldException {
Object person = new Person();
println(person.getClass().getDeclaredField("firstName").getAnnotation(Column.class).length());
}
}
Merging is a crude operation and should be avoided if possible