简体   繁体   English

休眠公式与一对多关系

[英]Hibernate Formula Vs One-to-Many Relationship

I have a product with many colors. 我有多种颜色的产品。

I used to map it using one-to-many relationship (list) and cont them together with a delimiter (",") 我曾经使用一对多关系(列表)来映射它,并将它们与一个定界符(“,”)连起来。

example: green,red,blue 例如:绿色,红色,蓝色

This is pretty slow when I attempt to retrieve 5000 of records even with JOIN Fetch. 当我尝试使用JOIN Fetch检索5000条记录时,这非常慢。

I am wondering should I use formula instead? 我想知道应该使用公式吗? I know formula will retrieve it using a sub select statement. 我知道公式将使用子select语句检索它。

oO O

make sure all fields (database columns) that you use as primary keys and foreign keys , in the where clause, and orderby clause have an index in the database. 确保在where子句和orderby子句中用作主键和外键的所有字段(数据库列)在数据库中都有索引。 other than that you should paste your code and sql so more detailed help/advice can be provided 除此之外,您应该粘贴代码和sql,以便可以提供更详细的帮助/建议

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

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