Posts Tagged With ‘JEE&8217


Schema Generation : Hibernate vs Toplink

Do you know why I like hiberante and dislike toplink?
A simple reason should be hibernate scheme generation can update columns and lots of stuff in existing table as mentioned below:

SchemaExport (hbm2ddl): This tool is provided with the core Hibernate download. It uses Hibernate mapping metadata XML files to generate a SQL database schema with DDL. You can enhance your mapping files with database specific elements (SQL column datatypes, unique/check constraints/indexes, etc.) and then export the SQL DDL to a text file. You may also directly export the DDL to a database, this is very powerful in development, as you can automatically create and drop a database at each test run. See the Hibernate reference documentation for more information about this tool.

On the other hand, toplink can not update existing database table. It is terrible ….


Dependency Injection

….
@EJB OrangeJuiceManagerLocal ojml;
@EJB WaterManagerLocal wml;
….

private OrangeJuice getSomeOrangeJuice(){

List oranges = ojml.finAllOranges();
Water water = wml.findColdWater();

return mixOrangeToWater(oranges,water);
}

….

😉