Does anyone initialize data by putting some code to static constructor of some initailizing class or something like that? I wonder where is posibillity like this:
@EJB //some bean
public someDataClassOrFacade {
static {
if(DataFacade.checkIfThereIsNoExampleData()) {
SomeDataClass sdc = new SomeDataClass();
// (...) set data
DataFacade.create(sdc);
}
}
}
What do you think about this way to initialize data? I am not convinced about using SQL queries with maven SQL plugin, because it has low flexibility (assuming data structure can change, especially columns names). But, i not pretty sure when class will be loaded. But this is only my theoretical practice, maybe you're using something far better than that? Thanks.