这是一个开放性的问题。我将开始一个新的项目,正在寻找不同的orm与数据库访问集成。
你有最喜欢的吗? 有什么你建议不要碰的吗?
这是一个开放性的问题。我将开始一个新的项目,正在寻找不同的orm与数据库访问集成。
你有最喜欢的吗? 有什么你建议不要碰的吗?
当前回答
SimpleORM,因为它是直接的,没有魔法。它在Java代码中定义了所有元数据结构,非常灵活。
SimpleORM provides similar functionality to Hibernate by mapping data in a relational database to Java objects in memory. Queries can be specified in terms of Java objects, object identity is aligned with database keys, relationships between objects are maintained and modified objects are automatically flushed to the database with optimistic locks. But unlike Hibernate, SimpleORM uses a very simple object structure and architecture that avoids the need for complex parsing, byte code processing etc. SimpleORM is small and transparent, packaged in two jars of just 79K and 52K in size, with only one small and optional dependency (Slf4j). (Hibernate is over 2400K plus about 2000K of dependent Jars.) This makes SimpleORM easy to understand and so greatly reduces technical risk.
其他回答
Hibernate,因为它基本上是Java中事实上的标准,并且是创建JPA的驱动力之一。Spring对它有很好的支持,几乎每个Java框架都支持它。最后,GORM是一个非常酷的包装器,它使用Groovy做动态查找器等。
它甚至被移植到。net (NHibernate),所以你也可以在那里使用它。
SimpleORM,因为它是直接的,没有魔法。它在Java代码中定义了所有元数据结构,非常灵活。
SimpleORM provides similar functionality to Hibernate by mapping data in a relational database to Java objects in memory. Queries can be specified in terms of Java objects, object identity is aligned with database keys, relationships between objects are maintained and modified objects are automatically flushed to the database with optimistic locks. But unlike Hibernate, SimpleORM uses a very simple object structure and architecture that avoids the need for complex parsing, byte code processing etc. SimpleORM is small and transparent, packaged in two jars of just 79K and 52K in size, with only one small and optional dependency (Slf4j). (Hibernate is over 2400K plus about 2000K of dependent Jars.) This makes SimpleORM easy to understand and so greatly reduces technical risk.
Eclipse Link,有很多原因,但值得注意的是,我觉得它比其他主流解决方案的膨胀要小(至少不那么让人头疼)。
哦,Eclipse Link已被选为JPA 2.0的参考实现
我建议使用MyBatis。它是JDBC之上的一个薄层,它很容易将对象映射到表,并且仍然使用纯SQL,一切都在您的控制之下。
我已经停止使用orm了。
原因并不是这个概念有什么大缺陷。Hibernate工作得很好。相反,我发现查询的开销很低,我可以将大量复杂的逻辑放入大型SQL查询中,并将大量处理转移到数据库中。
因此,请考虑只使用JDBC包。