简体   繁体   English

我们可以为 ORM 使用用户定义的(非标量)SQL 类型吗?

[英]Can we use user-defined (non-scalar) SQL-types for ORM?

I'm wondering if its possible to do ORM using SQL.2003 object types (aka STRUCTs, aka non-scalar types).我想知道是否可以使用 SQL.2003 object 类型(又名 STRUCT,又名非标量类型)来执行 ORM。

The idea behind that is to avoid the "n+1 selects" problem by retrieving complete objects directly from the database.其背后的想法是通过直接从数据库中检索完整对象来避免 “n+1 选择”问题 Sort of eager "FetchMode.JOIN", but in the database .有点急切的“FetchMode.JOIN”,但在数据库中

Are there any ORM frameworks fpor Java or.Net which support SQL object types at all?是否有任何 ORM 框架适用于 Java 或 .Net 支持 SQL ZA8CFDE 类型FDE6911BD59EB2AC6696?

At least JDBC has the getObject method and I've also found an example of user-defined types in ADO.Net至少 JDBC 有getObject 方法,我还在ADO.Net 中找到了用户定义类型的示例

As an Oracle developer, I may be biased towards database-centric approaches and I also didn't use ORM before.作为一名 Oracle 开发人员,我可能偏向于以数据库为中心的方法,而且我之前也没有使用过 ORM。 But Oracle features Object Views which let you compose objects from several relational tables.但是 Oracle 具有Object 视图,可让您从多个关系表中组合对象。 I bet these could be magnitudes faster than pulling all those single records out of the database, let alone issuing n+1 selects.我敢打赌,这可能比从数据库中提取所有这些单条记录要快得多,更不用说发出 n+1 个选择了。

I am the developer of jOOQ , and I am striving to make jOOQ exactly what you need.我是jOOQ的开发人员,我正在努力使 jOOQ 完全符合您的需求。 jOOQ currently supports any of these Oracle features: jOOQ 目前支持以下任何 Oracle 功能:

  • All types of SQL constructs, including nested selects, aliasing, union operations, etc所有类型的 SQL 构造,包括嵌套选择、别名、联合操作等
  • Stored procedures and functions存储过程和函数
  • Packages套餐
  • VARRAY types (mapped to Java arrays) VARRAY 类型(映射到 Java 数组)
  • UDT types (mapped to Java objects) UDT 类型(映射到 Java 对象)
  • combinations thereof它们的组合

More support will be added in the near future, for advanced Oracle concepts such as在不久的将来将添加更多支持,用于高级 Oracle 概念,例如

  • TABLE types表类型
  • CURSOR, REF CURSOR types CURSOR, REF CURSOR 类型
  • Other collection types其他收藏类型

Object views are currently not supported in the way you described, but I'll clearly put them on the roadmap.您描述的方式当前不支持 Object 视图,但我会明确地将它们放在路线图上。

See more on http://www.jooq.org查看更多关于http://www.jooq.org

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM