Hello colleagues,
I am writing a
junit test in which I create an IFile with content looking something
like this
String
content = "package
" +
packageName + ";\n\n"
+ "import
javax.persistence.*;\n\n"
+ "@Entity \n"
+ "public class " + entityShortName +
" {\n"
+ " @Id \n"
+ " private int id;\n"
+ " public int getId()
{\n"
+ " return id;\n"
+ " }\n"
+ " public void
setId(int id) {\n"
+ " this.id =
id;\n"
+ " }\n"
+ "}"; //$NON-NLS-1$
Then I try to
acquire the PersistenType using
for (Iterator<JpaStructureNode> i =
jpaFile.rootStructureNodes(); i.hasNext(); ) {
JpaStructureNode node = i.next();
if(node instanceof JavaPersistentType){
JavaPersistentType entity =
(JavaPersistentType) node;
return entity;
}
}
On some occasions the returned result is null.
My question is - is there a way to make sure that the context
jpa model is refreshed, or if I can get the JavaPersistentType in some
other way, that will ensure I will receive constant results.
Thanks in advance,
Milen
_______________________________________________
dali-dev mailing list
dali-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dali-dev