Closed GoogleCodeExporter closed 8 years ago
What is your problem with hibernate's classes?.
Please give us more information.
Thank's
Original comment by angelo.z...@gmail.com
on 12 Jun 2014 at 7:18
thanks for your reply.
i can't generate xml fields file when i use hibernate classes that linked each
other with some fields,when i run GenerateXMLFields class, i don't catch any
error or result.maybe i forgot somethi
public class GenerateXMLFields {
public static void main(String[] args) throws XDocReportException, FileNotFoundException, IOException{
FieldsMetadata fieldsMetadata = new FieldsMetadata(TemplateEngineKind.Velocity.name());
fieldsMetadata.load("SubmissionRequests", SubmissionRequests.class);
fieldsMetadata.load("SubreqItems", SubreqItems.class);
File xmlFieldsFile = new File("project.fields.xml");
fieldsMetadata.saveXML(new FileOutputStream(xmlFieldsFile), true);
}
Original comment by leila.s...@gmail.com
on 12 Jun 2014 at 7:49
It's not a problem with Hibernate but with your Pojo.
What is your problem (stacktrace?)
Please attach a simple Java main and your Pojo wich causes the problem.
@Pascal : I affect you this issue, if you have time to study it.
Original comment by angelo.z...@gmail.com
on 16 Jun 2014 at 12:51
Sure,
I will have a look at this issue as soon as I have time.
Probably not a lot this week, sorry.
My guess is an issue in bidirectional references between Java Object. Normally
the fieldsMetadata generator can handle this but we still have issues with
complex data models.
Best regards.
Original comment by pascal.leclercq
on 16 Jun 2014 at 1:19
thank you very much fo your reply.
i attached my hibernate classes, but that's not help to resolve problem because
these classes linked to many other classes, in fact all of my dataBase tables
linked each other.my java main as i mentioned later is:
public class GenerateXMLFields {
public static void main(String[] args) throws XDocReportException, FileNotFoundException, IOException{
FieldsMetadata fieldsMetadata = new FieldsMetadata(TemplateEngineKind.Velocity.name());
fieldsMetadata.load("SubmissionRequests", SubmissionRequests.class);
fieldsMetadata.load("SubreqItems", SubreqItems.class);
File xmlFieldsFile = new File("project.fields.xml");
fieldsMetadata.saveXML(new FileOutputStream(xmlFieldsFile), true);
}
for resolve this problem i wrote a function to generate xml code like your xml
pattern from sql,hibernate or other datasources.
my code is:
public boolean generateXMLFields(HttpServletRequest request) throws IOException{
try{
File file=new File(request.getServletContext().getRealPath("/")+"project.fields.xml");
file.createNewFile();
PrintWriter writer = new PrintWriter(file);
writer.println("<?xml version=\"1.0\" encoding=\"Windows-1256\" standalone=\"yes\" ?>");
writer.println("<fields templateEngineKind=\"Velocity\" ><description></description>");
for (XDocDataSource xDocDataSource : xDocDataSources) {
for (XDocDataSource.XDocFields fields : xDocDataSource.getListFields()) {
writer.println("<field name=\""+fields.name+"\" list=\""+fields.isList+"\" imageName=\"\" syntaxKind=\"\"><description>"+fields.description+"</description></field>");
}
}
writer.println("</fields>");
writer.close();
return true;
}catch(Exception ex){
ex.printStackTrace();
return false;
}
}
and it's work for us.(XDocDataSource is a class in our project that accept many
datasource types.)
thank you so much.
Kind Regards.
Original comment by leila.s...@gmail.com
on 18 Jun 2014 at 4:21
Attachments:
sorry i forgat that, i don't catch any error or result for the first code that
i wrote it above.
Original comment by leila.s...@gmail.com
on 18 Jun 2014 at 4:25
Original comment by angelo.z...@gmail.com
on 7 Aug 2014 at 6:01
cleanup
Original comment by pascal.leclercq
on 10 Oct 2014 at 7:37
Original issue reported on code.google.com by
leila.s...@gmail.com
on 12 Jun 2014 at 7:16