简体   繁体   中英

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.

I am wondering should I use formula instead? I know formula will retrieve it using a sub select statement.

oO

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. other than that you should paste your code and sql so more detailed help/advice can be provided

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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