Closed abhiramikl closed 6 years ago
What the Java compiler is trying to say: There is no EntitySqlGenerator
constructor with just the context. The generator needs always a Writer
as parameter, which is used as target of the generated statements.
How will I initialize Writer, I tried but giving some error.
It depends on your purpose: Where do you want to write the SQL statements? To a file or to a string? Either use a FileWriter
or a StringWriter
.
I need insert query of an entity class in a string.
The EntitySqlGenerator
is not for generating queries, it is for generating insert statements. That having said, here is an example how you could do that:
StringWriter writer = new StringWriter();
EntitySqlGenerator generator = new WriterEntitySqlGenerator(writer, context);
generator.write(myEntity);
String sql = writer.toString();
This example is for Fastnate 1.3 - in the upcoming version 1.4 the class structure has changed a little bit - but the concept is the same.
Hallo, Still same issue occurs when i try this code also.Code is given below: StringWriter writer = new StringWriter(); EntitySqlGenerator e = new EntitySqlGenerator(writer , this.context); e.write(courseRecords);
You have to use a WriterEntitySqlGenerator
in Fastnate 1.3.
I'm using fastnate1.3.0, when calling WriterEntitySqlGenerator this error is throwing :
nested exception is java.lang.UnsupportedClassVersionError: org/fastnate/generator/WriterEntitySqlGenerator : Unsupported major.minor version 52.0 (unable to load class org.fastnate.generator.WriterEntitySqlGenerator)] with root cause java.lang.UnsupportedClassVersionError: org/fastnate/generator/WriterEntitySqlGenerator : Unsupported major.minor version 52.0 (unable to load class org.fastnate.generator.WriterEntitySqlGenerator)
It seems that you are developing or testing with Java 7. As Fastnate 1.3.0 was compiled with Java 8, you will have to switch to either Java 8 or Java 9.
Hai, Fastnate1.2 also doesn't support with Java 7. My development environment works only in java 7. Can u suggest which version will support with Java
On Wed 28 Feb, 2018 3:06 am Tobias Liefke, notifications@github.com wrote:
It seems that you are developing or testing with Java 7. As Fastnate 1.3.0 was compiled with Java 8, you will have to switch to either Java 8 or Java 9.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/liefke/org.fastnate/issues/31#issuecomment-369034568, or mute the thread https://github.com/notifications/unsubscribe-auth/APkwt1sMVNsS0PCk00WXK-NTx7C1iBTAks5tZHVTgaJpZM4SQX6d .
As you can see here, the last version that supported Java 1.7 was 1.0.0-RC1. But that version was never published to Maven-Central. It is still available from our binary repository, which you can access as defined in our download section (look for snapshot builds).
As the RC1 indicates, that version had still some bugs - I hope you can use it nevertheless.
EntitySqlGenerator e = new EntitySqlGenerator(this.context); e.write(courseEntity); When creating an object of EntitySqlGenerator this error comes
"Cannot instantiate the type EntitySqlGenerator"
How can I solve it?