Home > Database > Mysql Tutorial > 为Oracle view 加主键解决hibernate 复合主键问题

为Oracle view 加主键解决hibernate 复合主键问题

WBOY
Release: 2016-06-07 17:04:08
Original
1183 people have browsed it

Oracle视图默认是没有主键的,因此在用hibernate反向生成java类时,会自动采用复合主键,多生成一个类名+ID的类,给后期开发带麻

Oracle视图默认是没有主键的,因此在用hibernate反向生成java类时,会自动采用复合主键,,多生成一个类名+ID的类,给后期开发带麻烦。

因此给oracle视图加上主键是解决问题的一个选择。

sql语句如下:

CREATE OR REPLACE VIEW  v_xxx(id,text, CONSTAIN id_pk PRIMARY KEY(id) RELY DISABLE NOVALIDATE) AS

SELELCT xxx.code id, xxx.name text

FROM  xxx

WHERE something;

linux

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template