Reputation: 1729
I want to create and maintain a relatively simple relational database in my java app, to save info between web sessions, and do SQL-like queries on. I have read up on JPA, Hibernate, Eclipselink etc - none seem all that simplistic. What's the simplest option to get up and running?
Upvotes: 0
Views: 260
Reputation: 6487
How about CouchDB + Ektorp API? Couch DB can be setup easily, and ektorp api provides almost everything. The only con might be: it is a no-sql db.
Upvotes: 1
Reputation: 29884
If you do not want to use an ORM (which are necessarily complex since they are generic and need to cover a lot of cases), you have quite a few choices if you are willing to look at non-relational,
The historical relational solution: do it yourself by mapping your object properties to table columns and calling the DB through the JDBC layer. It cannot be much faster and efficient but is the hardest to maintain. Spring JDBC may ease your pain.
If you do not really care about doing elaborate queries: serialize your object using Java serialization or a framework like Kryo (fast), XStream (xml) or Jackson (json) then save your blob/properties to the DB. You may actually look at a non-SQL db to store this very efficiently, like CouchDB
A (very hype :-)) NO-SQL like serialization: serialize to JSON and store in MongoDB or serialize to XML then store in DB2 or MS-SQL in XML columns or in a native XML server like eXist. All these DBs provide query languages on the stored object:
Upvotes: 2
Reputation: 2040
Ok,
the oldscool way is to use the sql-taglib in jsp-files
you need:
now, create an meta-inf/context.xml and refer the database create an jsp and do your sql-work like the tutorial here (clickme)
Upvotes: 1