我正在使用hibernate 4.0作为我项目之一的orm ...
当我尝试session.get( Table.class, 1 )
时,我收到以下错误...
Caused by: java.sql.SQLSyntaxErrorException: ORA-00904: "TABLETYPE0_"."TTPNAME": invalid identifier
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:863)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1153)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1275)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3576)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3620)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:116)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:82)
... 24 more
Hibernate:
select
tabletype0_.ttp_id as ttp_id1_8_,
tabletype0_.ttp_delete_fl as ttp_delete_fl2_8_,
tabletype0_.ptn_id as ptn_id3_8_,
tabletype0_.ttpCreatedDttm as ttpCreatedDttm4_8_,
tabletype0_.ttpName as ttpName5_8_,
tabletype0_.ttpVersion as ttpVersion6_8_
from
table_type tabletype0_
where
tabletype0_.ttpName='system'
我的hibernate的注释映射如下......
@javax.persistence.Basic
@javax.persistence.Column(
name = "ttp_name",
nullable = true,
insertable = true,
updatable = true )
@org.hibernate.annotations.Type(
type = "org.custom.hibernate.types.StringType" )
@javax.validation.constraints.NotNull
@org.hibernate.validator.constraints.NotEmpty
@org.hibernate.validator.constraints.Length( max = 255 )
private String ttpName;
public String getTtpName()
{
return this.ttpName;
}
public void setTtpName( String val )
{
this.ttpName = val;
}
我不知道我在做什么错误...因为我在db中将列名称作为ttp_name,所以hibernate尝试使用标识符ttpName进行查询...请有人帮我这个......
提前致谢...