Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要为没有主键的 oracle 物化视图创建一个实体类,并且还需要映射 xml 文件。不知道怎么办,谁能给点建议。提前致谢。
Hibernate/JPA 需要一个主键:
一种可能的解决方案是在每次刷新物化视图时以及在创建它时创建一个新的主键。您可以通过将其添加到 MV 的 create 语句中来做到这一点:
CREATE MATERIALIZED VIEW viewname ... WITH PRIMARY KEY AS SELECT rawtohex(sys_guid()) as ID, ... FROM tablename;