EclipseLink 버전은 2.5.1입니다.엔티티 생성자에서 직접 속성을 EclipseLink로 참조 할 수 있습니까?
우리는 GlassFish 웹 서버에서 TomCat로 이동했습니다. 이것은 Tomcat의 역동적 인 직조로는 쉽게 작동하지 않기 때문에 정적 직조로 전환했습니다. 정적 위빙이 작동 했으므로 이제는 약간 다르게 작동하는 것 같습니다. 내가 생성자에서 직접 몇 가지 속성을 설정하는 엔티티가있는 경우 이 발생
Entity e = new Entity();
assertEquals("something", e.getName()); // e.getName() returns null
을 getName()
때문에, 직조 후, 더 이상 this.name
을 반환하지 않습니다 :
class Entity {
@Column
private String name;
public Entity() {
name = "something";
}
public String getName() {
return name;
}
}
길고도 짧은 이야기이 테스트가 실패합니다 . 대신 초기화를위한 라우팅을 호출하고 (필요한 경우) 기본 HashMap에서 속성 값을 가져옵니다.
/**
* Construct a MethodWeaver and allow it to process the method.
*/
@Override
public MethodVisitor visitMethod(int access, String methodName, String desc, String signature, String[] exceptions) {
MethodVisitor mv = super.visitMethod(access, methodName, desc, signature, exceptions);
if (!alreadyWeaved) {
// skip constructors, they will not changed
if (!"<init>".equals(methodName) && !"<cinit>".equals(methodName)) {
// remaining modifications to the 'body' of the class are
// delegated to MethodWeaver
mv = new MethodWeaver(this, methodName, desc, mv);
}
}
return mv;
}
이 문제는, 어쩌면 내가 여기서 뭔가를 그리워된다 하지만 생성자 난 위버의 근원으로보고 명시 적으로이 밖으로 탈퇴 것 같다 한 길쌈하고 있지? 엔티티의 자체 ctor에서 직접적으로 특성을 사용할 수 없다는 것은 EclipseLink 2.5.1의 실제적인 현실입니까? (그리고 심지어 어디에도 언급되지 않았습니다. 적어도 googlable은 아닙니다)