hibernate subclass map 父类到子类时转换出错(大家帮下忙)(1)

07-10-26 dxadnwfn
本人现在刚开始写hibernate 程序,现在在配置hibernate的时候出现问题;

问题主要原因是这样

1.hibernate的配置文件可以正常加载

2.查询父类时,查询通过(结构一会详细说明)

3.在用一个父类的ID去查询时且赋值给父类对象时,语句可以正常打印出来,说明执行成功

4.同样用父类的ID去查询时且强行给子类时,出现错误码.错误的原因是不能强行转化.

现在我把我的表结构,程序,配置文件贴出来请大家看看,这个问题应该怎么解决,或者说这个表结构,配置文件怎么配置...谢谢了

表结构:

主:

CREATE TABLE XDZX.CREDIT_INQUIRY (

ID BIGINT NOT NULL,

TYPE VARCHAR(3),

TYPE_NAME VARCHAR(100),

NO VARCHAR(23),

CREATE_TIME TIMESTAMP,

UPDATE_TIME TIMESTAMP,

ORGANIZATION_NO VARCHAR(6),

UPDATE_ORGANIZATION_NO VARCHAR(6),

STAFFER_NO VARCHAR(7),

UPDATE_STAFFER_NO VARCHAR(7),

CLASS VARCHAR(20),

PRIMARY KEY(ID)

)

GO

子类:相同结构的七张表,因为数据量大,为了减轻表的压力所以按业务分为七张

-------------------------------------------------------------------

CREATE TABLE XDZX.CREDIT_INQUIRY_BULLETIN (

CREDIT_INQUIRY_ID BIGINT NOT NULL,

NAME VARCHAR(100) not Null,

VALUE VARCHAR(254),

FIELD_TYPE VARCHAR(60),

PRIMARY KEY(CREDIT_INQUIRY_ID,name)

)

GO

ALTER TABLE XDZX.CREDIT_INQUIRY_BULLETIN

ADD CONSTRAINT F_FK_BULLETIN

FOREIGN KEY(CREDIT_INQUIRY_ID)

REFERENCES XDZX.CREDIT_INQUIRY(ID)

ON DELETE RESTRICT

ON UPDATE RESTRICT

GO

-------------------------------------------------------------------

CREATE TABLE XDZX.CREDIT_INQUIRY_CONSENT_SCHEME (

CREDIT_INQUIRY_ID BIGINT NOT NULL,

NAME VARCHAR(100) not null,

VALUE VARCHAR(254),

FIELD_TYPE VARCHAR(60),

PRIMARY KEY(CREDIT_INQUIRY_ID,name)

)

GO

ALTER TABLE XDZX.CREDIT_INQUIRY_CONSENT_SCHEME

ADD CONSTRAINT F_FK_CONSENT_SCHEM

FOREIGN KEY(CREDIT_INQUIRY_ID)

REFERENCES XDZX.CREDIT_INQUIRY(ID)

ON DELETE RESTRICT

ON UPDATE RESTRICT

GO

继二.....

dxadnwfn
2007-10-26 14:53
二的地址:

http://www.jdon.com/jivejdon/thread/32924.html

三的地址:

http://www.jdon.com/jivejdon/thread/32925.html

猜你喜欢