BuddyJoe
BuddyJoe

Reputation: 71111

Java, Code Generation, and Persistence Frameworks

Are there any Java code generation persistence frameworks? Something that is "database first" rather than object model first? I know this is probably heresy in the Java world, I'd just like to know if any frameworks like this exist.

I'm more of a .NET guy these days. So on the .NET-side tools like .NET Tiers or CSLA come to mind.

Upvotes: 4

Views: 1354

Answers (8)

John T
John T

Reputation: 713

Telosys Tools is a free "database first" code generator

See : https://sites.google.com/site/telosystools/

It's an Eclipse plugin, the templates are customizable if necessary

It can generate the persistance layer (JPA) but also the CRUD Screen ( tutorials are here : https://sites.google.com/site/telosystutorial/ )

Upvotes: 2

Lars Høidahl
Lars Høidahl

Reputation: 470

DB Importer is an Eclipse plug-in that generates JPA classes from a database.

Disclaimer: I am the creator of DB Importer.

Upvotes: 2

Lukas Eder
Lukas Eder

Reputation: 220952

I developed jOOQ to exactly suit your needs - so don't worry about the heresy :-)

Check out the examples page or an article on dzone illustrating my motivations of creating such a framework. The main advantages are:

  • It generates source code
  • It stays close to SQL by providing a SQL-like DSL in Java
  • It supports easy access vendor-specific features, such as UDT's, stored procedures
  • It supports all advanced SQL features, such as UNIONs, nested SELECTs, aliasing, etc

Note that jOOQ is NOT really an OR-mapper. It focuses on the relational datamodel from your RDBMS and doesn't give you the possibility to create your custom object-oriented domain model like Hibernate or JPA do. This is precisely for the reason you mentioned yourself: Something that is "database first" rather than object model first

Upvotes: 3

nawroth
nawroth

Reputation: 4361

I would recommend HiberObjects. It's an Eclipse plugin that can be used to model persistent objects or reverse engineer an existing database. The way it lets you set up unit tests is truly awesome. You can also modify how for instance DAO classes are generated: just modify a Groovy script and all DAO-classes are re-generated. I have encountered a few bugs, but the guy behind it has been very responsive and released fixes in short time. A description and user ratings/comments are found at Eclipse Plugin Central.

Upvotes: 1

Markus
Markus

Reputation: 1822

The Apache Cayenne ORM framework is able to reverse engineer a database. See here.

Upvotes: 3

Surya
Surya

Reputation: 4982

Checkout EclipseLink project ( plugins for eclipse) , you can generate JPA models from database tables

Upvotes: 2

jsight
jsight

Reputation: 28419

Many of the Java-based persistence tools include tools to generate code based upon an existing schema. Netbeans will generate JPA (including Session bean facades, if desired). Similarly, JBoss Tools for Eclipse will generate Hibernate JavaBeans for you based upon an existing schema.

Upvotes: 1

dfa
dfa

Reputation: 116342

sure, hibernate and netbeans for example can reverse engineering a database. You may be want to look at:

  • Hibernate Tools; site in maintenance
  • netbeans, with recent version of netbeans you can create JPA entities from a JDBC connection

My 2 cents.

Upvotes: 3

Related Questions