异常描述:ejb3.0程序中使用jpa做持久化,使用的数据库为sql server2000,在jboss中部署。在查询Client这个实体的时候,抛出以下异常
-----------------------------------------------------------------------------
2010-05-06 17:08:42,640 INFO [org.hibernate.type.StringType] could not read column value from result set: memo0_0_; [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
2010-05-06 17:08:42,640 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: S1002
2010-05-06 17:08:42,640 ERROR [org.hibernate.util.JDBCExceptionReporter] [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
2010-05-06 17:08:42,640 INFO [org.hibernate.event.def.DefaultLoadEventListener] Error performing load command
org.hibernate.exception.GenericJDBCException: could not load an entity: [com.xxx.Client#3]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1874)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
------------------------------------------------------
其中Client实体定义(部分代码)
-----------------------------------------------------------------
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@Transient
protected boolean create;
// private String memo;
private boolean deleteFlag;
private String code;
private String fullName;
private String tel;
private String fax;
@OneToOne
private Area area;
@Transient
private String areaName;-----------------------------------------------------------------以上定义的实体,在使用mysql数据库时不会出现以上异常,请各位帮忙分析一下,谢谢了!还有在jboss中部署的时候,会出现jpa不能自动更新表结构的情况,异常代码如下:
-------------------------------------------------------------
2010-05-06 17:00:43,421 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] updating schema
2010-05-06 17:00:43,484 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: S1002
2010-05-06 17:00:43,484 ERROR [org.hibernate.util.JDBCExceptionReporter] [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
2010-05-06 17:00:43,484 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] could not complete schema update
org.hibernate.exception.GenericJDBCException: could not get table metadata: client
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(DatabaseMetadata.java:105)
at org.hibernate.cfg.Configuration.generateSchemaUpdateScript(Configuration.java:948)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:140)
--------------------------------------------------------------
-----------------------------------------------------------------------------
2010-05-06 17:08:42,640 INFO [org.hibernate.type.StringType] could not read column value from result set: memo0_0_; [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
2010-05-06 17:08:42,640 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: S1002
2010-05-06 17:08:42,640 ERROR [org.hibernate.util.JDBCExceptionReporter] [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
2010-05-06 17:08:42,640 INFO [org.hibernate.event.def.DefaultLoadEventListener] Error performing load command
org.hibernate.exception.GenericJDBCException: could not load an entity: [com.xxx.Client#3]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1874)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
------------------------------------------------------
其中Client实体定义(部分代码)
-----------------------------------------------------------------
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@Transient
protected boolean create;
// private String memo;
private boolean deleteFlag;
private String code;
private String fullName;
private String tel;
private String fax;
@OneToOne
private Area area;
@Transient
private String areaName;-----------------------------------------------------------------以上定义的实体,在使用mysql数据库时不会出现以上异常,请各位帮忙分析一下,谢谢了!还有在jboss中部署的时候,会出现jpa不能自动更新表结构的情况,异常代码如下:
-------------------------------------------------------------
2010-05-06 17:00:43,421 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] updating schema
2010-05-06 17:00:43,484 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: S1002
2010-05-06 17:00:43,484 ERROR [org.hibernate.util.JDBCExceptionReporter] [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
2010-05-06 17:00:43,484 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] could not complete schema update
org.hibernate.exception.GenericJDBCException: could not get table metadata: client
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(DatabaseMetadata.java:105)
at org.hibernate.cfg.Configuration.generateSchemaUpdateScript(Configuration.java:948)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:140)
--------------------------------------------------------------
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货