- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在通过标准执行查询-
try {
hsSession = HibernateUtil.getSession();
List<StdOrgUsersV> l = (List<StdOrgUsersV>) hsSession.createCriteria(StdOrgUsersV.class)
.add(Restrictions.eq("partyType", ptype))
.add(Restrictions.isNotNull("userId")).list();
for(StdOrgUsersV souv:l){
ar.add(souv.getUserId());
ar.add(souv.getPartyFullName());
}
} catch (Exception e) {
e.printStackTrace();
}
StdOrgUsersV 类-
@Column(name = "ID", nullable = false)
@Id
@GeneratedValue(generator = "generator")
@Basic(optional = false)
@GenericGenerator(name = "generator", strategy = "increment")
private long id;
@Column(name = "USER_ID", nullable = false)
private long userId;
@Column(name = "ORG_UNIT_ID", nullable = false)
private long orgUnitId;
@Column(name = "INTERNAL_FLAG")
private Boolean internalFlag;
@Column(name = "PARENT_USER_ID")
private Long parentUserId;
@Column(name = "ROLE_ID")
private Long roleId;
@Column(name = "DEPARTMENT", length = 20)
private String department;
@Column(name = "USER_LOCATION_ID")
private Long userLocationId;
@Column(name = "SCREEN_WIDTH")
private Integer screenWidth;
@Column(name = "SCREEN_HEIGHT")
private Integer screenHeight;
@Column(name = "COMMENTS", length = 1000)
private String comments;
@Column(name = "REV_REF_ID")
private Long revRefId;
@Column(name = "REVISION_NO", nullable = false)
private int revisionNo;
@Column(name="ACTIVE_FLAG", nullable=false)
private boolean activeFlag;
@Column(name = "START_DATE", nullable = false, length = 23)
@Temporal(javax.persistence.TemporalType.DATE)
private Date startDate;
@Column(name = "END_DATE", length = 23)
@Temporal(javax.persistence.TemporalType.DATE)
private Date endDate;
@Column(name = "CREATED_BY", nullable = false)
private long createdBy;
@Column(name = "CREATION_DATE", nullable = false, length = 23)
@Temporal(javax.persistence.TemporalType.DATE)
private Date creationDate;
@Column(name = "UPDATED_BY")
private Long updatedBy;
@Column(name = "UPDATE_DATE", length = 23)
@Temporal(javax.persistence.TemporalType.DATE)
private Date updateDate;
@Column(name = "APPROVAL_LIMIT", precision = 18)
private BigDecimal approvalLimit;
@Column(name = "user_name", length = 50)
private String userName;
@Column(name = "role_name", length = 50)
private String roleName;
@Column(name = "Org_Type_Name", length = 100)
private String orgTypeName;
@Column(name = "ORG_UNIT_TYPE", length = 10)
private String orgUnitType;
@Column(name = "PARTY_TYPE", length = 20)
private String partyType;
@Column(name = "ORG_UNIT_NAME", length = 50)
private String orgUnitName;
@Column(name = "Dept_Name", length = 100)
private String deptName;
@Column(name = "parent_party_name", length = 100)
private String parentPartyName;
@Column(name = "Party_id")
private Long partyId;
@Column(name = "Party_Full_Name", length = 100)
private String partyFullName;
@Column(name = "LOCATION_NAME", length = 50)
private String locationName;
@Column(name = "Loc_Type_Name", length = 100)
private String locTypeName;
@Column(name = "LOCATION_TYPE", length = 20)
private String locationType;
@Column(name = "parent1_id")
private Long parent1Id;
@Column(name = "parent1_loc_name", length = 50)
private String parent1LocName;
@Column(name = "parent1_loc_type", length = 20)
private String parent1LocType;
@Column(name = "parent2_id")
private Long parent2Id;
@Column(name = "parent2_loc_name", length = 50)
private String parent2LocName;
@Column(name = "parent2_loc_type", length = 20)
private String parent2LocType;
@Column(name = "parent3_id")
private Long parent3Id;
@Column(name = "parent3_loc_name", length = 50)
private String parent3LocName;
@Column(name = "parent3_loc_type", length = 20)
private String parent3LocType;
@Column(name = "parent4_id")
private Long parent4Id;
@Column(name = "parent4_loc_name", length = 50)
private String parent4LocName;
@Column(name = "parent4_loc_type", length = 20)
private String parent4LocType;
@Column(name = "parent5_id")
private Long parent5Id;
@Column(name = "parent5_loc_name", length = 50)
private String parent5LocName;
@Column(name = "parent5_loc_type", length = 20)
private String parent5LocType;
@Column(name = "parent_role_id")
private Long parentRoleId;
@Column(name = "Parent_Role_Name", length = 50)
private String parentRoleName;
@Column(name = "ORG_ADDRESS", length = 200)
private String orgAddress;
@Column(name = "parent1_role_id")
private Long parent1RoleId;
@Column(name = "parent1_role_name", length = 50)
private String parent1RoleName;
@Column(name = "parent2_role_id")
private Long parent2RoleId;
@Column(name = "parent2_role_name", length = 50)
private String parent2RoleName;
@Column(name = "parent3_role_id")
private Long parent3RoleId;
@Column(name = "parent3_role_name", length = 50)
private String parent3RoleName;
@Column(name = "parent4_role_id")
private Long parent4RoleId;
@Column(name = "parent4_role_name", length = 50)
private String parent4RoleName;
@Column(name = "parent5_role_id")
private Long parent5RoleId;
@Column(name = "parent5_role_name", length = 50)
private String parent5RoleName;
@Column(name = "parent6_role_id")
private Long parent6RoleId;
@Column(name = "parent6_role_name", length = 50)
private String parent6RoleName;
@Column(name = "parent7_role_id")
private Long parent7RoleId;
@Column(name = "parent7_role_name", length = 50)
private String parent7RoleName;
@Column(name = "parent8_role_id")
private Long parent8RoleId;
@Column(name = "parent8_role_name", length = 50)
private String parent8RoleName;
@Column(name = "parent9_role_id")
private Long parent9RoleId;
@Column(name = "parent9_role_name", length = 50)
private String parent9RoleName;
@Column(name = "parent10_role_id")
private Long parent10RoleId;
@Column(name = "parent10_role_name", length = 50)
private String parent10RoleName;
@Column(name = "EMAIL", length = 50)
private String email;
@Column(name = "PARTY_TITLE", length = 10)
private String partyTitle;
@Column(name = "PARTY_NAME", length = 100)
private String partyName;
@Column(name = "CONTACT_NO", length = 15)
private String contactNo;
@Column(name = "ADDRESS_LINE1", length = 200)
private String addressLine1;
@Column(name = "CITY", length = 20)
private String city;
@Column(name = "STATE", length = 20)
private String state;
@Column(name = "LOCATION_ID")
private Long locationId;
@Column(name = "PARTY_START_DATE", length = 23)
@Temporal(javax.persistence.TemporalType.DATE)
private Date partyStartDate;
@Column(name = "USER_GROUP_ID")
private Long userGroupId;
@Column(name = "user_group_name", length = 50)
private String userGroupName;
gettrs and setters....
我已经检查了 hibernate 在 Sql server 中创建的查询,它工作正常但是在执行上面的条件时我得到以下异常-
Hibernate: select this_.ID as ID11_0_, this_.USER_ID as USER2_11_0_, this_.ORG_UNIT_ID as ORG3_11_0_, this_.INTERNAL_FLAG as INTERNAL4_11_0_, this_.PARENT_USER_ID as PARENT5_11_0_, this_.ROLE_ID as ROLE6_11_0_, this_.DEPARTMENT as DEPARTMENT11_0_, this_.USER_LOCATION_ID as USER8_11_0_, this_.SCREEN_WIDTH as SCREEN9_11_0_, this_.SCREEN_HEIGHT as SCREEN10_11_0_, this_.COMMENTS as COMMENTS11_0_, this_.REV_REF_ID as REV12_11_0_, this_.REVISION_NO as REVISION13_11_0_, this_.ACTIVE_FLAG as ACTIVE14_11_0_, this_.START_DATE as START15_11_0_, this_.END_DATE as END16_11_0_, this_.CREATED_BY as CREATED17_11_0_, this_.CREATION_DATE as CREATION18_11_0_, this_.UPDATED_BY as UPDATED19_11_0_, this_.UPDATE_DATE as UPDATE20_11_0_, this_.APPROVAL_LIMIT as APPROVAL21_11_0_, this_.user_name as user22_11_0_, this_.role_name as role23_11_0_, this_.Org_Type_Name as Org24_11_0_, this_.ORG_UNIT_TYPE as ORG25_11_0_, this_.PARTY_TYPE as PARTY26_11_0_, this_.ORG_UNIT_NAME as ORG27_11_0_, this_.Dept_Name as Dept28_11_0_, this_.parent_party_name as parent29_11_0_, this_.Party_id as Party30_11_0_, this_.Party_Full_Name as Party31_11_0_, this_.LOCATION_NAME as LOCATION32_11_0_, this_.Loc_Type_Name as Loc33_11_0_, this_.LOCATION_TYPE as LOCATION34_11_0_, this_.parent1_id as parent35_11_0_, this_.parent1_loc_name as parent36_11_0_, this_.parent1_loc_type as parent37_11_0_, this_.parent2_id as parent38_11_0_, this_.parent2_loc_name as parent39_11_0_, this_.parent2_loc_type as parent40_11_0_, this_.parent3_id as parent41_11_0_, this_.parent3_loc_name as parent42_11_0_, this_.parent3_loc_type as parent43_11_0_, this_.parent4_id as parent44_11_0_, this_.parent4_loc_name as parent45_11_0_, this_.parent4_loc_type as parent46_11_0_, this_.parent5_id as parent47_11_0_, this_.parent5_loc_name as parent48_11_0_, this_.parent5_loc_type as parent49_11_0_, this_.parent_role_id as parent50_11_0_, this_.Parent_Role_Name as Parent51_11_0_, this_.ORG_ADDRESS as ORG52_11_0_, this_.parent1_role_id as parent53_11_0_, this_.parent1_role_name as parent54_11_0_, this_.parent2_role_id as parent55_11_0_, this_.parent2_role_name as parent56_11_0_, this_.parent3_role_id as parent57_11_0_, this_.parent3_role_name as parent58_11_0_, this_.parent4_role_id as parent59_11_0_, this_.parent4_role_name as parent60_11_0_, this_.parent5_role_id as parent61_11_0_, this_.parent5_role_name as parent62_11_0_, this_.parent6_role_id as parent63_11_0_, this_.parent6_role_name as parent64_11_0_, this_.parent7_role_id as parent65_11_0_, this_.parent7_role_name as parent66_11_0_, this_.parent8_role_id as parent67_11_0_, this_.parent8_role_name as parent68_11_0_, this_.parent9_role_id as parent69_11_0_, this_.parent9_role_name as parent70_11_0_, this_.parent10_role_id as parent71_11_0_, this_.parent10_role_name as parent72_11_0_, this_.EMAIL as EMAIL11_0_, this_.PARTY_TITLE as PARTY74_11_0_, this_.PARTY_NAME as PARTY75_11_0_, this_.CONTACT_NO as CONTACT76_11_0_, this_.ADDRESS_LINE1 as ADDRESS77_11_0_, this_.CITY as CITY11_0_, this_.STATE as STATE11_0_, this_.LOCATION_ID as LOCATION80_11_0_, this_.PARTY_START_DATE as PARTY81_11_0_, this_.USER_GROUP_ID as USER82_11_0_, this_.user_group_name as user83_11_0_ from STD_ORG_USERS_V this_ where this_.PARTY_TYPE=?
Hibernate: select this_.ID as ID11_0_, this_.USER_ID as USER2_11_0_, this_.ORG_UNIT_ID as ORG3_11_0_, this_.INTERNAL_FLAG as INTERNAL4_11_0_, this_.PARENT_USER_ID as PARENT5_11_0_, this_.ROLE_ID as ROLE6_11_0_, this_.DEPARTMENT as DEPARTMENT11_0_, this_.USER_LOCATION_ID as USER8_11_0_, this_.SCREEN_WIDTH as SCREEN9_11_0_, this_.SCREEN_HEIGHT as SCREEN10_11_0_, this_.COMMENTS as COMMENTS11_0_, this_.REV_REF_ID as REV12_11_0_, this_.REVISION_NO as REVISION13_11_0_, this_.ACTIVE_FLAG as ACTIVE14_11_0_, this_.START_DATE as START15_11_0_, this_.END_DATE as END16_11_0_, this_.CREATED_BY as CREATED17_11_0_, this_.CREATION_DATE as CREATION18_11_0_, this_.UPDATED_BY as UPDATED19_11_0_, this_.UPDATE_DATE as UPDATE20_11_0_, this_.APPROVAL_LIMIT as APPROVAL21_11_0_, this_.user_name as user22_11_0_, this_.role_name as role23_11_0_, this_.Org_Type_Name as Org24_11_0_, this_.ORG_UNIT_TYPE as ORG25_11_0_, this_.PARTY_TYPE as PARTY26_11_0_, this_.ORG_UNIT_NAME as ORG27_11_0_, this_.Dept_Name as Dept28_11_0_, this_.parent_party_name as parent29_11_0_, this_.Party_id as Party30_11_0_, this_.Party_Full_Name as Party31_11_0_, this_.LOCATION_NAME as LOCATION32_11_0_, this_.Loc_Type_Name as Loc33_11_0_, this_.LOCATION_TYPE as LOCATION34_11_0_, this_.parent1_id as parent35_11_0_, this_.parent1_loc_name as parent36_11_0_, this_.parent1_loc_type as parent37_11_0_, this_.parent2_id as parent38_11_0_, this_.parent2_loc_name as parent39_11_0_, this_.parent2_loc_type as parent40_11_0_, this_.parent3_id as parent41_11_0_, this_.parent3_loc_name as parent42_11_0_, this_.parent3_loc_type as parent43_11_0_, this_.parent4_id as parent44_11_0_, this_.parent4_loc_name as parent45_11_0_, this_.parent4_loc_type as parent46_11_0_, this_.parent5_id as parent47_11_0_, this_.parent5_loc_name as parent48_11_0_, this_.parent5_loc_type as parent49_11_0_, this_.parent_role_id as parent50_11_0_, this_.Parent_Role_Name as Parent51_11_0_, this_.ORG_ADDRESS as ORG52_11_0_, this_.parent1_role_id as parent53_11_0_, this_.parent1_role_name as parent54_11_0_, this_.parent2_role_id as parent55_11_0_, this_.parent2_role_name as parent56_11_0_, this_.parent3_role_id as parent57_11_0_, this_.parent3_role_name as parent58_11_0_, this_.parent4_role_id as parent59_11_0_, this_.parent4_role_name as parent60_11_0_, this_.parent5_role_id as parent61_11_0_, this_.parent5_role_name as parent62_11_0_, this_.parent6_role_id as parent63_11_0_, this_.parent6_role_name as parent64_11_0_, this_.parent7_role_id as parent65_11_0_, this_.parent7_role_name as parent66_11_0_, this_.parent8_role_id as parent67_11_0_, this_.parent8_role_name as parent68_11_0_, this_.parent9_role_id as parent69_11_0_, this_.parent9_role_name as parent70_11_0_, this_.parent10_role_id as parent71_11_0_, this_.parent10_role_name as parent72_11_0_, this_.EMAIL as EMAIL11_0_, this_.PARTY_TITLE as PARTY74_11_0_, this_.PARTY_NAME as PARTY75_11_0_, this_.CONTACT_NO as CONTACT76_11_0_, this_.ADDRESS_LINE1 as ADDRESS77_11_0_, this_.CITY as CITY11_0_, this_.STATE as STATE11_0_, this_.LOCATION_ID as LOCATION80_11_0_, this_.PARTY_START_DATE as PARTY81_11_0_, this_.USER_GROUP_ID as USER82_11_0_, this_.user_group_name as user83_11_0_ from STD_ORG_USERS_V this_ where this_.PARTY_TYPE=?
org.hibernate.exception.DataException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:77)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2214)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
at org.hibernate.loader.Loader.list(Loader.java:2090)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:95)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305)
at WF.workflow.getUsersVikas(workflow.java:547)
at org.apache.jsp.MARICON.ParentUser_jsp._jspService(ParentUser_jsp.java:149)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: The value supplied cannot be converted to BIGINT.
at net.sourceforge.jtds.jdbc.Support.convert(Support.java:653)
at net.sourceforge.jtds.jdbc.JtdsResultSet.getLong(JtdsResultSet.java:645)
at net.sourceforge.jtds.jdbc.JtdsResultSet.getLong(JtdsResultSet.java:972)
at org.hibernate.type.LongType.get(LongType.java:28)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2046)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1371)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1299)
at org.hibernate.loader.Loader.getRow(Loader.java:1197)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:568)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2211)
... 30 more
请帮忙。
最佳答案
我建议您根据您在 bean 中声明的列的类型来验证列的类型,因为这似乎存在类型转换问题。
Caused by: java.sql.SQLException: The value supplied cannot be converted to BIGINT.
我注意到有些字段是long
,有些是Long
;这应该没问题。但是最好使用基元或引用;但不是混合体。
作为快速检查,我建议您检查retrieving all
是否正常工作。
hsSession.createQuery("from StdOrgUsersV").list()
如果上面的查询也出现同样的问题,那显然是数据类型的问题;不是因为 Criteria
。
关于hibernate - 组织.hibernate.exception.DataException : could not execute query,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20495676/
您好,我在执行以下查询时遇到 DataException: GET_USERLIST_BY_GROUP1 = " SELECT usr.user_id, usr.login_n
我正在尝试保留一个实体: @Entity @Table(name = "note") public class Note extends Abstrac
我在使用 .NET Core 1.0 时遇到以下编译错误: “The type or namespace name 'DataException' could not be found (are yo
static void Main(string[] args) { try { Console.WriteLine("No Error"); } cat
我正在使用 Hibernate (hibernate3.jar) 和对象“Cliente”,如下所示: public class Cliente { private nombre; .
我正在通过标准执行查询- try { hsSession = HibernateUtil.getSession(); List l = (List) hsSessi
我是 Spring 和 Hibernate 的新手,我正在开发电子商务管理系统,我的麻烦在于使用 Hibernate 将文件上传到数据库中。我有一些服务,但我发现它不起作用。 这是我的代码 领域 @E
我一直在关注这个教程Getting Started with Entity Framework 6 Code First using MVC 5 . 当我到达需要运行程序的部分并单击“学生”以便程序创
尝试使用 java 中的 kafka.connect.data.Schema 在特定对象类型的数组模式中创建并填充字符串类型的数组模式。但出现错误 org.apache.kafka.connect.e
我收到这个错误: Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect integer value: 'A
最近,我重构了一些代码,导致从 System.String 更改实体的某些属性的类型。至 System.URI .相关属性的名称包含子字符串 URI 或 URL 和 SonarLint静态代码分析器建
我是一名优秀的程序员,十分优秀!