的信息, 清单 3 中给出了被 Enhance 过后 Animal 实体类的类声明和方法签名信息,从 中我们可以看到 Animal 被增加了新的 org.apache.openjpa.enhance.PersistenceCapable 接口,而该接口声明的方法 都是和实体创建、状态保持等相关的。事实上,OpenJPA 通过 Enhance 过程修改 我们的实体类,扩充了实体类的能力,从而实现性能优化、懒惰式装载等高级特 性。
清单 3 Animal 被 Enhance 过后的类声明和方法信息
1. public class org.vivianj.openjpa.entity.Animal
2. extends java.lang.Object
3. implements org.apache.openjpa.enhance.PersistenceCapable {
4. protected transient org.apache.openjpa.enhance.StateManager pcStateManager;
5. protected transient byte pcFlags;
6. static java.lang.Class class$Ljava$lang$String;
7. static java.lang.Class class$Lorg$vivianj$openjpa$entity$Animal;
8. public org.vivianj.openjpa.entity.Animal();
9. public int getId();
10. public void setId(int);
11. public java.lang.String getName();
12. public void setName(java.lang.String);
13. static final {};
14. static java.lang.Class class$(java.lang.String);
15. protected void pcClearFields();
16. public org.apache.openjpa.enhance.PersistenceCapable pcNewInstance(
17. org.apache.openjpa.enhance.StateManager, java.lang.Object, boolean);
18. public org.apache.openjpa.enhance.PersistenceCapable pcNewInstance(
19. org.apache.openjpa.enhance.StateManager, boolean);
20. protected static int pcGetManagedFieldCount();
21. public void pcReplaceField(int);
22. public void pcReplaceFields(int[]);
23. public void pcProvideField(int);
24. public void pcProvideFields(int[]);
25. protected void pcCopyField (org.vivianj.openjpa.entity.Animal, int);
26. public void pcCopyFields(java.lang.Object, int[]);
27. public java.lang.Object pcGetGenericContext();
28. public java.lang.Object pcFetchObjectId();
29. public boolean pcIsDeleted();
30. public boolean pcIsDirty();
31. public boolean pcIsNew();
32. public boolean pcIsPersistent();
33. public boolean pcIsTransactional();
34. public boolean pcSerializing();
35. public void pcDirty(java.lang.String);
36. public org.apache.openjpa.enhance.StateManager pcGetStateManager();
37. public java.lang.Object pcGetVersion();
38. public void pcReplaceFlags();
39. public synchronized void pcReplaceStateManager(
40. org.apache.openjpa.enhance.StateManager)
41. throws java.lang.SecurityException;
42. public void pcCopyKeyFieldsToObjectId(
43. org.apache.openjpa.enhance.FieldSupplier, java.lang.Object);
44. public void pcCopyKeyFieldsToObjectId (java.lang.Object);
45. public void pcCopyKeyFieldsFromObjectId(
46. org.apache.openjpa.enhance.FieldConsumer, java.lang.Object);
47. public void pcCopyKey
|