我想在 DB 上插入一個(gè)條目,該條目已填充所有字段,并且與另一個(gè)表/類(lèi)具有 @ManyToOne 關(guān)系。為此,我正在調(diào)用entityManager.merge(c1),其中 myc1是一個(gè)Classification實(shí)例(根據(jù)下面的定義),我可以在日志中看到以下內(nèi)容:[DEBUG] ...: c=o.h.SQL, m=logStatement, l=92, msg: insert into plat.classification_system (year, system, id) values (?, ?, ?)[TRACE] ...: c=o.h.t.d.s.BasicBinder, m=bind, l=65, msg: binding parameter [1] as [VARCHAR] - [2012][TRACE] ...: c=o.h.t.d.s.BasicBinder, m=bind, l=65, msg: binding parameter [2] as [BIGINT] - [1000001][TRACE] ...: c=o.h.t.d.s.BasicBinder, m=bind, l=65, msg: binding parameter [3] as [VARCHAR] - [main_system]......實(shí)際上我期待看到類(lèi)似......[DEBUG] ...: c=o.h.SQL, m=logStatement, l=92, msg: insert into plat.classification_system (year, system, id, classification_type) values (?, ?, ?, ?)[TRACE] ...: c=o.h.t.d.s.BasicBinder, m=bind, l=65, msg: binding parameter [1] as [VARCHAR] - [2012][TRACE] ...: c=o.h.t.d.s.BasicBinder, m=bind, l=65, msg: binding parameter [2] as [BIGINT] - [1000001][TRACE] ...: c=o.h.t.d.s.BasicBinder, m=bind, l=65, msg: binding parameter [3] as [VARCHAR] - [main_system][TRACE] ...: c=o.h.t.d.s.BasicBinder, m=bind, l=65, msg: binding parameter [4] as [VARCHAR] - [abc]...代表以下模型: create table classification_system ( id number(19, 0) not null, year varchar2(255 char) not null, class_type_guid(48 char ) not null, system varchar2(255 char) not null, primary key (id) ) create table class_type ( guid (48 char) not null, code varchar2(255 char) not null, year varchar2(255 char) not null, system_type_guid varchar2(48 char) not null, primary key (guid) ) create table system_type ( guid (48 char ) not null, code varchar2(255 char) not null, year varchar2(255 char) not null, primary key (guid) )我一直在挖掘很多與@ManyToOne映射/關(guān)系相關(guān)的帖子,但還沒(méi)有找到任何我可以使用的東西。這是使用 Hibernate 5.0.9 構(gòu)建的。有人可以幫我解決這個(gè)問(wèn)題嗎?感謝您對(duì)此事的任何幫助。
添加回答
舉報(bào)
0/150
提交
取消