This blog is about Java (advanced Java topics like Reflection, Byte Code transformation, Code Generation), Maven, Web technologies, Raspberry Pi and IT in general.

Montag, 1. Juni 2015

spBee - generate the model classes

If you don't know spBee then please read my other blog post first. But if you are in hurry then here is a very short description of spBee: it generates the code to execute stored procedures and to map the result into your model classes. This is done by writing the model classes, interfaces and some annotations.

It's cool and it works very well. But there's still one thing that bothered me because it's just boring: the creation of the model classes. Therefore I have written a quite simple program. This program will execute your stored procedure with the your arguments, read the result and then creates the model classes. It's basic, but it works fine. With a little work you could optimize it so that it generates the Java files which you can put into your project without any additional work.
The program just uses the ResultSetMetaData and the JCodeMode. There is also an unit test to demonstrate the usage of the program.

Keine Kommentare:

Kommentar veröffentlichen