i googled the phrase "lightweight ORM for j2ee" and find this page http://java-source.net/open-source/persistence from one of results. my goal is to find an ORM Framework that is lighter than Hibernate and also delivers some of hibernates features that are most important to me, for example: auto table generating and lazy initializing, and don't give me hard time with tables and maps and collection. it is also important that the coming ORM has a community around it which makes it faster to find solutions to errors and bugs. and it also is important that the new orm hides the database from me (needs less sql skills and be more OO). so far i have narrowed my choices to iBatis (myBatis) and ORMLite. i want this ORM for my new project which is a desktop application in j2ee, so it is important that the start up time for this orm be less than others (unlike Hibernate which takes a lot of time for first time running specially when you have lots of tables)
thnx
I am afraid that you might have misunderstood concepts. You basically aren't looking for alternative to Hibernate, but an alternative to ORM.
Hibernate is one of the very few attempts of proper ORM. Hibernate tries to solve most of of paradigms of object/relational mismatch. Those are:
See Java Persistence with Hibernate for more information.
To sum up, there is no such thing as lighter ORM. There is either proper ORM solution, or other solutions - like myBatis, where instead of mapping relational model to object model you map SQL statements to objects and methods.
And don't forget - you don't have to use all of Hibernate features. You can quite comfortably mix it with custom SQL, plain JDBC and use only subset of it's capabilities.
edit1: about slow startup
Intermezzo: I am currently working with one propietary ORM solution (not as smart as Hibernate tough) whitch was tuned specially for our application. The biggest issue is also startup, that's becuase mapping the whole database to objects simply isn't trivial.
Now, as for Hibernate. Maybe you know, that Hibernate also generates CRUD SQL statements on startup. If you have big database this can impact performance. But, you can turn off this startup SQL generation and switch to dynamic statements generated at runtime.
Using XML notation, it can be achieved like this:
<class name="SomeClass"
dynamic-insert="true"
dynamic-update="true">
...
</class>
Or with Hibernate annotations:
@Entity
@org.hibernate.annotations.Entity(
dynamicInsert = true, dynamicUpdate = true
)
public class SomeClass { ...
edit2: about mixing custom SQL
The referenced book Java Persistence with Hibernate explains things rather in depth. Chapter 8 is about working with legacy databases and it also gives hints how to alter DML (like with custom SQL, you can even replace CRUD code with custom SQL!) and DDL(generic runtime DDL manipulation). You should peek there :)