EJB design: A small and easy JPA
I know that after RoR(Ruby on Rails) every one is working toward making a simple architecture for ORM and RPC and so am I!!! I will really like people to get actively involve in it by reading, leaving comments or by writing code. Please visit the web site to get the idea of it. http://sites.google.com/a/cynosuredev.com/simple-orm/Home The whole concept of the project is to bring simplicity in Java without loosing its power. No project should force a developer to use a certain web container or libraries that work only on higher version of JRE, or no API should ever make developer learn a lot of things.
All ORMs started as small and easy... You should take a look at some of the open solutions already out there: solutions that have bought into JPA already provide RDB access with the simplicity you suggest. Reading up on these implementations will point you to some of the hidden complexity in this space. For example avoiding the need to derive from a particular class, handling relationships, queries across more than one object type, inheritance, generated identifiers - to name a few.
I guess I was expecting something more JPA/Mapping orientated rather than Active Record orientated... Anyway in terms of how to 'simplify' JPA I have my own thoughts on that. Firstly using a "sessionless" architecture and also reviewing the query language, joins, partial objects etc. My attempt to simplify JPA can be found at http://www.avaje.org and is called Ebean. It uses the JPA annotations for mapping @Entity @OneToMany etc... but simplifies the API. Query query = Ebean.createQuery(Order.class); query.join("details"); query.where().eq("customer.id", 27); List orders = query.findList(); Note the lack of a "session" object. Not everyone's cup of tea but I think it makes life simpler. For me its the EntityManager (session object) and the associated merge/detach/flush which complicates JPA compared with a save/delete. Good luck with your active record approach. There are some other efforts in that area under development.
sapan parikh, this posting reminds me of the original posting I saw from the Ruby On rails Creation or should I say bashing of Java. Of course that was valid, such as this posting, the difference is that everyone knew with the infrastructure of Java and j2EE at the time, we all hated it, and wanted something different for productivity sakes. I think the world's community have all agreed, JPA (All it's flavors) is the way for ORM at this time. It does look like great work you have done, and I did check out the http://www.avaje.org/ site and looked at the code samples. I must admit appears to be simpler, but in the world I live in which is Java on several tiers, Detachment is a reality of Serialization, which adds the complexity and the notion of session management, which I don't see in your examples. Yes yours example and premise is Fantastic if you can live in that world. But the complexities of merging and session management grew, and appears to be servicing the needs of most people. There are problems, why there are new versions, but generally I think the issues is now a closed issue in most developers minds. Lord knows, with your developer mind, there are lots of problems that have not been solved yet, or solutions really really suck! and need people like you to build tools like your EBean framework for them. I hope I could convince you to spend your great talent on more of those, and it is obvious you are truly great at what you do. Ya know... Don't re-invent the wheel (JPA), go invent the hover craft. type of thinking.... But Great work and thanks, it's been an Eye opener...I will actually use EBeans tonight for a quick prototype. Tony McClay Sun Certified Enterprise Architect JEE 5 (SCEA CS-310-052) Sun Certified Business Components Developer JEE5 (SCBCD CX-310-091) Sun Certified Web Components Developer (SCWCD CX-310-081) Sun Certified Java Programmer 5 (SCJP CX-310-056)