The Hibernate mapping view generates a federated primary key. When querying, if the Union primary key (in fact, not just a joint primary key, a single primary key is also,
If NULL, the entire result returned is NULL, and then the whole results return null
In a project, you encounter the problem of having a null field in a database table, and after mapping to a view,
Causes the result set to be NULL when the program queries the view, and the statement in the program queries the database correctly, making people depressed, the solution is as follows
Build the view, the value of Mo one field (ID) is paid to Mrid, so that the Mrid is not NULL, the query will not be a problem
Create or replace view Xssf_xlsh_view as
select
T. " ID "as" Mrid, --the core point, assigning the null value field
T. " ID ",
T." Station_Name ",
T." Line_name ",
T." Dept_name ",
T." Dept_code ",
T." By_gdl ",
T." By_sdl ",
T." By_zb_sdl ",
T." By_xsl ",
T." By_tb_xsl ",
T." Stat_date ",
T." Lj_gdl ",
T." Lj_sdl ",
T." Lj_zb_sdl ",
T." Lj_xsl ",
T." Lj_tb_xsl ",
T." line_id ",
t.count_date,
A." Layorder "
from Current_order_area A, xssf_xlsh@datacenterlink. Regress. Rdbms. DEV. US. oracle.com t
where a.dept_code = T.dept_code;