[Hibernate-JIRA] Commented: (HHH-1830) Error during parse query on MS SQL
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830?page=c... ]
Max Rydahl Andersen commented on HHH-1830:
------------------------------------------
to start with having a patch for the test suite to reproduce the error would be the minimum ;)
> Error during parse query on MS SQL
> ----------------------------------
>
> Key: HHH-1830
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.1.2, 3.2.0.cr2
> Environment: Microsoft SQL Server 2000, Windows XP, JDK 1.5 Update 4
> Reporter: Den Raskovalov
> Priority: Critical
>
> HQL: select deal, items.dateBegin, client.Title from " + CoreDeal.class.getName() + " deal left join deal.stagesWorkflowInstance.history.items items, " + CoreClient.class.getName() + " client where stageResponsible=:stageResponsible and items.index=maxindex(items) and deal.parent=client and deal.stagesWorkflowInstance.Stage.showOnPersonalPage=1
> It works normally on Oracle, but on MS SQL produces:
> Error: String index out of range: -5
> [java.lang.StringIndexOutOfBoundsException]
> java.lang.String.substring(String.java:1768)
> java.lang.String.substring(String.java:1735)
> org.hibernate.hql.CollectionSubqueryFactory.createCollectionSubquery(CollectionSubqueryFactory.java:32)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:301)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:291)
> org.hibernate.hql.ast.tree.FromElement.toColumns(FromElement.java:377)
> org.hibernate.hql.ast.tree.MethodNode.resolveCollectionProperty(MethodNode.java:115)
> org.hibernate.hql.ast.tree.MethodNode.collectionProperty(MethodNode.java:95)
> org.hibernate.hql.ast.tree.MethodNode.resolve(MethodNode.java:44)
> org.hibernate.hql.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:844)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:2324)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1285)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4032)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3521)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1758)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1686)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
> org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:227)
> org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:159)
> org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:110)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
> org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
> org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
> org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1612)
> ru.naumen.crm2.bobjects.deal.CoreDealHibernateHandler.listAllDealsWithSortDataByResponsible(CoreDealHibernateHandler.java:109)
> ru.naumen.crm2.ui.tlc.CoreEmployeeTableListController.listMyDealsSorted(CoreEmployeeTableListController.java:70)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 11 months
[Hibernate-JIRA] Commented: (HHH-1830) Error during parse query on MS SQL
by Tim McCune (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830?page=c... ]
Tim McCune commented on HHH-1830:
---------------------------------
Sorry, I spent 4 hours digging through the code yesterday trying to come up with a patch, and there is a ridiculous amount of code involved. Without a lot of context, I don't know how effective I will be at this. Creating a test case should be easy enough. It's very straight-forward to demonstrate the bug. Have you tried to repro this and failed, or are you just looking for low-hanging fruit? If it's the former, let me know and I will create a test case. FWIW, here is my debug log and stack trace:
2008-02-01 09:58:43,488 DEBUG [org.hibernate.hql.ast.QueryTranslatorImpl] (http-127.0.0.1-8080-1) parse() - HQL: select queue.id from com.linebuster.common.Queue queue join queue.authorizedTicketTakers t, com.linebuster.common.Employee employee where employee in elements(t) and employee.account.userid = :principal
2008-02-01 09:58:43,494 DEBUG [org.hibernate.hql.ast.AST] (http-127.0.0.1-8080-1) --- HQL AST ---
\-[QUERY] 'query'
+-[SELECT_FROM] 'SELECT_FROM'
| +-[FROM] 'from'
| | +-[RANGE] 'RANGE'
| | | +-[DOT] '.'
| | | | +-[DOT] '.'
| | | | | +-[DOT] '.'
| | | | | | +-[IDENT] 'com'
| | | | | | \-[IDENT] 'linebuster'
| | | | | \-[IDENT] 'common'
| | | | \-[IDENT] 'Queue'
| | | \-[ALIAS] 'queue'
| | +-[JOIN] 'join'
| | | +-[DOT] '.'
| | | | +-[IDENT] 'queue'
| | | | \-[IDENT] 'authorizedTicketTakers'
| | | \-[ALIAS] 't'
| | \-[RANGE] 'RANGE'
| | +-[DOT] '.'
| | | +-[DOT] '.'
| | | | +-[DOT] '.'
| | | | | +-[IDENT] 'com'
| | | | | \-[IDENT] 'linebuster'
| | | | \-[IDENT] 'common'
| | | \-[IDENT] 'Employee'
| | \-[ALIAS] 'employee'
| \-[SELECT] 'select'
| \-[DOT] '.'
| +-[IDENT] 'queue'
| \-[IDENT] 'id'
\-[WHERE] 'where'
\-[AND] 'and'
+-[IN] 'in'
| +-[IDENT] 'employee'
| \-[IN_LIST] 'inList'
| \-[ELEMENTS] 'elements'
| \-[IDENT] 't'
\-[EQ] '='
+-[DOT] '.'
| +-[DOT] '.'
| | +-[IDENT] 'employee'
| | \-[IDENT] 'account'
| \-[IDENT] 'userid'
\-[COLON] ':'
\-[IDENT] 'principal'
2008-02-01 09:58:43,494 DEBUG [org.hibernate.hql.ast.ErrorCounter] (http-127.0.0.1-8080-1) throwQueryException() : no errors
2008-02-01 09:58:43,494 DEBUG [org.hibernate.hql.antlr.HqlSqlBaseWalker] (http-127.0.0.1-8080-1) select << begin [level=1, statement=select]
2008-02-01 09:58:43,495 DEBUG [org.hibernate.hql.ast.tree.FromElement] (http-127.0.0.1-8080-1) FromClause{level=1} : com.linebuster.common.Queue (queue) -> queue0_
2008-02-01 09:58:43,495 DEBUG [org.hibernate.hql.ast.tree.FromReferenceNode] (http-127.0.0.1-8080-1) Resolved : queue -> queue0_.id
2008-02-01 09:58:43,495 DEBUG [org.hibernate.hql.ast.tree.DotNode] (http-127.0.0.1-8080-1) getDataType() : authorizedTicketTakers -> org.hibernate.type.SetType(com.linebuster.common.Queue.authorizedTicketTakers)
2008-02-01 09:58:43,496 DEBUG [org.hibernate.hql.ast.tree.FromElementFactory] (http-127.0.0.1-8080-1) createManyToMany() : path = queue.authorizedTicketTakers role = com.linebuster.common.Queue.authorizedTicketTakers associatedEntityName = com.linebuster.common.Employee
2008-02-01 09:58:43,496 DEBUG [org.hibernate.hql.ast.tree.FromElement] (http-127.0.0.1-8080-1) FromClause{level=1} : com.linebuster.common.Employee (t) -> employee2_
2008-02-01 09:58:43,496 DEBUG [org.hibernate.hql.ast.tree.FromClause] (http-127.0.0.1-8080-1) addJoinByPathMap() : queue.authorizedTicketTakers -> Employee employee2_
2008-02-01 09:58:43,496 DEBUG [org.hibernate.hql.ast.tree.DotNode] (http-127.0.0.1-8080-1) dereferenceCollection() : Created new FROM element for queue.authorizedTicketTakers : QueueTicketTaker employee2_
2008-02-01 09:58:43,496 DEBUG [org.hibernate.hql.ast.tree.FromReferenceNode] (http-127.0.0.1-8080-1) Resolved : queue.authorizedTicketTakers -> .
2008-02-01 09:58:43,497 DEBUG [org.hibernate.hql.ast.HqlSqlWalker] (http-127.0.0.1-8080-1) createFromJoinElement() : -- join tree --
\-[JOIN_FRAGMENT] FromElement: 'QueueTicketTaker employee2_' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=t,role=com.linebuster.common.Queue.authorizedTicketTakers,tableName=Employee,tableAlias=employee2_,origin=Queue queue0_,colums={queue0_.id ,className=com.linebuster.common.Employee}}
2008-02-01 09:58:43,497 DEBUG [org.hibernate.hql.ast.tree.FromElement] (http-127.0.0.1-8080-1) FromClause{level=1} : com.linebuster.common.Employee (employee) -> employee3_
2008-02-01 09:58:43,497 DEBUG [org.hibernate.hql.ast.tree.FromReferenceNode] (http-127.0.0.1-8080-1) Resolved : queue -> queue0_.id
2008-02-01 09:58:43,497 DEBUG [org.hibernate.hql.ast.tree.DotNode] (http-127.0.0.1-8080-1) getDataType() : id -> org.hibernate.type.LongType@46ccf
2008-02-01 09:58:43,497 DEBUG [org.hibernate.hql.ast.tree.FromReferenceNode] (http-127.0.0.1-8080-1) Resolved : queue.id -> queue0_.id
2008-02-01 09:58:43,498 DEBUG [org.hibernate.hql.ast.tree.FromReferenceNode] (http-127.0.0.1-8080-1) Resolved : employee -> employee3_.id
2008-02-01 09:58:43,502 DEBUG [org.hibernate.hql.ast.tree.FromReferenceNode] (http-127.0.0.1-8080-1) Resolved : t -> employee2_.id
2008-02-01 09:58:43,502 DEBUG [org.hibernate.hql.ast.tree.MethodNode] (http-127.0.0.1-8080-1) Creating elements for t[].elements
2008-02-01 09:58:43,505 ERROR [com.linebuster.server.AuthenticatorBean] (http-127.0.0.1-8080-1) System exception
java.lang.StringIndexOutOfBoundsException: String index out of range: -5
at java.lang.String.substring(String.java:1938)
at java.lang.String.substring(String.java:1905)
at org.hibernate.hql.CollectionSubqueryFactory.createCollectionSubquery(CollectionSubqueryFactory.java:32)
at org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:300)
at org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:290)
at org.hibernate.hql.ast.tree.FromElement.toColumns(FromElement.java:390)
at org.hibernate.hql.ast.tree.MethodNode.handleElements(MethodNode.java:162)
at org.hibernate.hql.ast.tree.MethodNode.resolveCollectionProperty(MethodNode.java:109)
at org.hibernate.hql.ast.tree.CollectionFunction.resolve(CollectionFunction.java:22)
at org.hibernate.hql.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:834)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.collectionFunction(HqlSqlBaseWalker.java:2558)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.collectionFunctionOrSubselect(HqlSqlBaseWalker.java:4245)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.inRhs(HqlSqlBaseWalker.java:4161)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3842)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1762)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1687)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:92)
at org.jboss.ejb3.entity.TransactionScopedEntityManager.createQuery(TransactionScopedEntityManager.java:134)
> Error during parse query on MS SQL
> ----------------------------------
>
> Key: HHH-1830
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.1.2, 3.2.0.cr2
> Environment: Microsoft SQL Server 2000, Windows XP, JDK 1.5 Update 4
> Reporter: Den Raskovalov
> Priority: Critical
>
> HQL: select deal, items.dateBegin, client.Title from " + CoreDeal.class.getName() + " deal left join deal.stagesWorkflowInstance.history.items items, " + CoreClient.class.getName() + " client where stageResponsible=:stageResponsible and items.index=maxindex(items) and deal.parent=client and deal.stagesWorkflowInstance.Stage.showOnPersonalPage=1
> It works normally on Oracle, but on MS SQL produces:
> Error: String index out of range: -5
> [java.lang.StringIndexOutOfBoundsException]
> java.lang.String.substring(String.java:1768)
> java.lang.String.substring(String.java:1735)
> org.hibernate.hql.CollectionSubqueryFactory.createCollectionSubquery(CollectionSubqueryFactory.java:32)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:301)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:291)
> org.hibernate.hql.ast.tree.FromElement.toColumns(FromElement.java:377)
> org.hibernate.hql.ast.tree.MethodNode.resolveCollectionProperty(MethodNode.java:115)
> org.hibernate.hql.ast.tree.MethodNode.collectionProperty(MethodNode.java:95)
> org.hibernate.hql.ast.tree.MethodNode.resolve(MethodNode.java:44)
> org.hibernate.hql.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:844)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:2324)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1285)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4032)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3521)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1758)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1686)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
> org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:227)
> org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:159)
> org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:110)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
> org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
> org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
> org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1612)
> ru.naumen.crm2.bobjects.deal.CoreDealHibernateHandler.listAllDealsWithSortDataByResponsible(CoreDealHibernateHandler.java:109)
> ru.naumen.crm2.ui.tlc.CoreEmployeeTableListController.listMyDealsSorted(CoreEmployeeTableListController.java:70)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 11 months
[Hibernate-JIRA] Created: (HHH-3093) Hibernate Exception
by Achappan M (JIRA)
Hibernate Exception
-------------------
Key: HHH-3093
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3093
Project: Hibernate3
Issue Type: Bug
Components: query-sql
Affects Versions: 3.1.3
Environment: Hibernate 3.0, MySQL
Reporter: Achappan M
Hil,
I got the following exception when i saved the data into the database. I can identified, my data is not committed in db. Here i specified my java classes. Please anyone guide me to solve this problem.
21:27:44,359 ERROR [STDERR] org.hibernate.MappingException: Unknown entity: com.construction.beans.PersonalInfo
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:610)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1246)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:89)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:524)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:510)
at com.construction.DB.DBUtil.save(DBUtil.java:48)
at com.construction.Servlets.AddPersonalInfo.personalInfo(AddPersonalInfo.java:48)
at com.construction.Servlets.AddPersonalInfo.doGet(AddPersonalInfo.java:25)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Unknown Source)
personalInfo.hbm File:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.construction.beans.PersonalInfo" table="personalinfo" >
<id name="emp_code" column = "EMP_CODE" type="java.lang.Long">
<generator class="increment"/>
</id>
<property name="employee_Name" type="java.lang.String"/>
<property name="father_Name" type="java.lang.String"/>
<property name="mother_Name" type="java.lang.String"/>
<property name="dob" type="java.lang.String"/>
<property name="gender" type="java.lang.String"/>
<property name="marital_status" type="java.lang.String"/>
<property name="bloodgroup" type="java.lang.String"/>
<property name="qualification" type="java.lang.String"/>
<property name="address" type="java.lang.String"/>
<property name="email" type="java.lang.String"/>
<property name="mobileno" type="java.lang.String"/>
<one-to-one name="salaryInfo" class="com.construction.beans.SalaryInfo"
cascade="all" constrained="false"/>
<!-- property name="empPhoto" type="java.lang.String"/-->
</class>
</hibernate-mapping>
salaryInfo.hbm.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.construction.beans.SalaryInfo" table="SalaryInfo" >
<id name="emp_code" column = "EMP_CODE" type="java.lang.Long">
<generator class="increment"/>
</id>
<property name="empno" type="java.lang.String"/>
<property name="doj" type="java.lang.String"/>
<property name="designation" type="java.lang.String"/>
<property name="accountno" type="java.lang.String"/>
<property name="basic" type="java.lang.String"/>
<property name="allowance" type="java.lang.String"/>
<property name="ot_per_hour" type="java.lang.String"/>
<property name="pfno" type="java.lang.String"/>
<property name="esicno" type="java.lang.String"/>
<property name="mem_UHID" type="java.lang.String"/>
<property name="licno" type="java.lang.String"/>
<!-- property name="empPhoto" type="java.lang.String"/-->
</class>
</hibernate-mapping>
Persistent Class:
package com.construction.beans;
import java.io.Serializable;
public class PersonalInfo implements Serializable{
/**Personal Details**/
private long emp_code;
private String employee_Name;
private String father_Name;
private String mother_Name;
private String dob;
private String gender;
private String marital_status;
private String bloodgroup;
private String qualification;
private String address;
private String email;
private String mobileno;
private String empPhoto;
private SalaryInfo salaryInfo;
public long getEmp_code() {
return emp_code;
}
public void setEmp_code(long emp_code) {
this.emp_code = emp_code;
}
public String getEmployee_Name() {
return employee_Name;
}
public void setEmployee_Name(String employee_Name) {
this.employee_Name = employee_Name;
}
public String getFather_Name() {
return father_Name;
}
public void setFather_Name(String father_Name) {
this.father_Name = father_Name;
}
public String getMother_Name() {
return mother_Name;
}
public void setMother_Name(String mother_Name) {
this.mother_Name = mother_Name;
}
public String getDob() {
return dob;
}
public void setDob(String dob) {
this.dob = dob;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getMarital_status() {
return marital_status;
}
public void setMarital_status(String marital_status) {
this.marital_status = marital_status;
}
public String getBloodgroup() {
return bloodgroup;
}
public void setBloodgroup(String bloodgroup) {
this.bloodgroup = bloodgroup;
}
public String getQualification() {
return qualification;
}
public void setQualification(String qualification) {
this.qualification = qualification;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getMobileno() {
return mobileno;
}
public void setMobileno(String mobileno) {
this.mobileno = mobileno;
}
public String getEmpPhoto() {
return empPhoto;
}
public void setEmpPhoto(String empPhoto) {
this.empPhoto = empPhoto;
}
public SalaryInfo getSalaryInfo() {
return salaryInfo;
}
public void setSalaryInfo(SalaryInfo salaryInfo) {
this.salaryInfo = salaryInfo;
}
}
DBUtil.java
package com.construction.DB;
import java.io.File;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import com.construction.beans.PersonalInfo;
public class DBUtil
{
private SessionFactory sf;
private static DBUtil ed=null;
public static DBUtil create()
{
if(ed==null)
{
ed=new DBUtil();
System.out.println("instance created");
}
return ed;
}
private DBUtil()
{
String path=System.getProperty("user.dir")+File.separator+"config"+File.separator;
File f=new File(path+"hibernate.cfg.xml");
Configuration cfg=new Configuration().configure(f);
sf=cfg.buildSessionFactory();
//new SchemaExport(cfg).create(true,true);
}
//create
public void save(Object o)
{
Session session = sf.openSession();
try
{
session.save(o);
System.out.println("Save session Object" + o);
session.beginTransaction().commit();
}
catch(Exception e)
{
System.out.println("Inside Exception=========>");
e.printStackTrace();
session.beginTransaction().rollback();
}
finally
{
session.close();
}
}
public void update(Object o)
{
Session session=sf.openSession();
try
{
session.update(o);
session.beginTransaction().commit();
}
catch(Exception e)
{
session.beginTransaction().rollback();
}
finally
{
session.close();
}
}
public void delete(Object o)
{
Session session=sf.openSession();
try
{
session.delete(o);
session.beginTransaction().commit();
}
catch(Exception e)
{
session.beginTransaction().rollback();
}
finally
{
session.close();
}
}
public List getLoginFormDetails()
{
Session session=sf.openSession();
List l = session.createCriteria(LoginForm.class).list();
return l;
}
public List getPersonalInfoDetails()
{
Session session=sf.openSession();
List l = session.createCriteria(PersonalInfo.class).list();
System.out.println("DBUtil: -----> listsize" + l.size());
return l;
}
}
My servlet Class:
package com.construction.Servlets;
import java.io.*;
import java.util.Iterator;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import com.construction.DB.DBInit;
import com.construction.DB.DBUtil;
import com.construction.beans.*;
public class AddPersonalInfo extends HttpServlet
{
DBUtil util;
protected void doGet(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
throws ServletException, IOException
{
//To set the content type for the server
//httpResponse.setContentType("text/html");
savePersonalInfo(httpRequest);
//Getting the data from the server and print the data into
//the browser.
// PrintWriter print = httpResponse.getWriter();
}
public void savePersonalInfo(HttpServletRequest httpRequest)
{
/*
* Get the employee personal information from the user and
* set it into the PersonalInfo
*/
PersonalInfo personalInfo = new PersonalInfo();
//personalInfo.setEmp_code(Long.parseLong(httpRequest.getParameter("emp_code")));
//personalInfo.setEmp_code(001);
personalInfo.setEmployee_Name(httpRequest.getParameter("employee_Name"));
personalInfo.setFather_Name(httpRequest.getParameter("father_Name"));
personalInfo.setMother_Name(httpRequest.getParameter("mother_Name"));
personalInfo.setDob(httpRequest.getParameter("dob"));
personalInfo.setGender(httpRequest.getParameter("gender"));
personalInfo.setMarital_status(httpRequest.getParameter("marital_status"));
personalInfo.setBloodgroup(httpRequest.getParameter("bloodgroup"));
personalInfo.setQualification(httpRequest.getParameter("qualification"));
personalInfo.setAddress(httpRequest.getParameter("address"));
personalInfo.setEmail(httpRequest.getParameter("email"));
personalInfo.setMobileno(httpRequest.getParameter("mobileno"));
personalInfo.setEmpPhoto(httpRequest.getParameter("empPhoto"));
System.out.println("Get Emp Name"+personalInfo.getEmployee_Name() );
System.out.println("Get Father Name"+personalInfo.getFather_Name());
/*
* Get the employee salary details from the user and
* set it into the SalaryInfo
*/
SalaryInfo salaryInfo = new SalaryInfo();
//salaryInfo.setEmp_code(001);
/*salaryInfo.setEmpno(httpRequest.getParameter("empno"));
salaryInfo.setDoj(httpRequest.getParameter("doj"));
salaryInfo.setDesignation(httpRequest.getParameter("designation"));
salaryInfo.setAccountno(httpRequest.getParameter("accountno"));
salaryInfo.setBasic(httpRequest.getParameter("basic"));
salaryInfo.setAllowance(httpRequest.getParameter("allowance"));
salaryInfo.setOt_per_hour(httpRequest.getParameter("ot_per_hour"));
salaryInfo.setPfno(httpRequest.getParameter("pfno"));
salaryInfo.setEsicno(httpRequest.getParameter("esicno"));
salaryInfo.setMem_UHID(httpRequest.getParameter("mem_UHID"));
salaryInfo.setLicno(httpRequest.getParameter("licno"));
System.out.println("Get Emp Name"+salaryInfo.getEmpno());
System.out.println("Get Father Name"+salaryInfo.getDoj());*/
//set the salary details into the personalinfo
personalInfo.setSalaryInfo(salaryInfo);
//save peronal information to the database
// create the object for the DBUtil
util = DBUtil.create();
util.save(personalInfo);
util.save(salaryInfo);
System.out.println("Object is creted for DBUtil");
/*if(util != null)
{
System.out.println("print Util Object" + util);
//if(personalInfo != null)
System.out.println("Save Persional & Salary Information ");
util.save(personalInfo);
System.out.println(personalInfo);
List list = util.getPersonalInfoDetails();
System.out.println("List " + list);
System.out.println("List " + list.size());
Iterator iterator = list.iterator();
System.out.println("Iterator"+ iterator);
while (iterator.hasNext ()) {
String o = (String) iterator.next ();
System.out.println(o);
}
System.out.println("Persional Information is Saved Sucessfully");
//util.save(salaryInfo);
//System.out.println("Salary Information is Saved Sucessfully");
}*/
}
}
Please send me the solution for my codings.
Thank You!
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 11 months
[Hibernate-JIRA] Commented: (HHH-1830) Error during parse query on MS SQL
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830?page=c... ]
Max Rydahl Andersen commented on HHH-1830:
------------------------------------------
testcase? patch ?
> Error during parse query on MS SQL
> ----------------------------------
>
> Key: HHH-1830
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.1.2, 3.2.0.cr2
> Environment: Microsoft SQL Server 2000, Windows XP, JDK 1.5 Update 4
> Reporter: Den Raskovalov
> Priority: Critical
>
> HQL: select deal, items.dateBegin, client.Title from " + CoreDeal.class.getName() + " deal left join deal.stagesWorkflowInstance.history.items items, " + CoreClient.class.getName() + " client where stageResponsible=:stageResponsible and items.index=maxindex(items) and deal.parent=client and deal.stagesWorkflowInstance.Stage.showOnPersonalPage=1
> It works normally on Oracle, but on MS SQL produces:
> Error: String index out of range: -5
> [java.lang.StringIndexOutOfBoundsException]
> java.lang.String.substring(String.java:1768)
> java.lang.String.substring(String.java:1735)
> org.hibernate.hql.CollectionSubqueryFactory.createCollectionSubquery(CollectionSubqueryFactory.java:32)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:301)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:291)
> org.hibernate.hql.ast.tree.FromElement.toColumns(FromElement.java:377)
> org.hibernate.hql.ast.tree.MethodNode.resolveCollectionProperty(MethodNode.java:115)
> org.hibernate.hql.ast.tree.MethodNode.collectionProperty(MethodNode.java:95)
> org.hibernate.hql.ast.tree.MethodNode.resolve(MethodNode.java:44)
> org.hibernate.hql.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:844)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:2324)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1285)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4032)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3521)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1758)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1686)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
> org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:227)
> org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:159)
> org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:110)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
> org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
> org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
> org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1612)
> ru.naumen.crm2.bobjects.deal.CoreDealHibernateHandler.listAllDealsWithSortDataByResponsible(CoreDealHibernateHandler.java:109)
> ru.naumen.crm2.ui.tlc.CoreEmployeeTableListController.listMyDealsSorted(CoreEmployeeTableListController.java:70)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 11 months
[Hibernate-JIRA] Commented: (HHH-1830) Error during parse query on MS SQL
by Tim McCune (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830?page=c... ]
Tim McCune commented on HHH-1830:
---------------------------------
This bug is over a year old and flagged as Critical. Could someone please take a look at it?
> Error during parse query on MS SQL
> ----------------------------------
>
> Key: HHH-1830
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1830
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.1.2, 3.2.0.cr2
> Environment: Microsoft SQL Server 2000, Windows XP, JDK 1.5 Update 4
> Reporter: Den Raskovalov
> Priority: Critical
>
> HQL: select deal, items.dateBegin, client.Title from " + CoreDeal.class.getName() + " deal left join deal.stagesWorkflowInstance.history.items items, " + CoreClient.class.getName() + " client where stageResponsible=:stageResponsible and items.index=maxindex(items) and deal.parent=client and deal.stagesWorkflowInstance.Stage.showOnPersonalPage=1
> It works normally on Oracle, but on MS SQL produces:
> Error: String index out of range: -5
> [java.lang.StringIndexOutOfBoundsException]
> java.lang.String.substring(String.java:1768)
> java.lang.String.substring(String.java:1735)
> org.hibernate.hql.CollectionSubqueryFactory.createCollectionSubquery(CollectionSubqueryFactory.java:32)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:301)
> org.hibernate.hql.ast.tree.FromElementType.toColumns(FromElementType.java:291)
> org.hibernate.hql.ast.tree.FromElement.toColumns(FromElement.java:377)
> org.hibernate.hql.ast.tree.MethodNode.resolveCollectionProperty(MethodNode.java:115)
> org.hibernate.hql.ast.tree.MethodNode.collectionProperty(MethodNode.java:95)
> org.hibernate.hql.ast.tree.MethodNode.resolve(MethodNode.java:44)
> org.hibernate.hql.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:844)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:2324)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1285)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4032)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3521)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1758)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1686)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1683)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
> org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
> org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:227)
> org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:159)
> org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:110)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
> org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
> org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
> org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
> org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1612)
> ru.naumen.crm2.bobjects.deal.CoreDealHibernateHandler.listAllDealsWithSortDataByResponsible(CoreDealHibernateHandler.java:109)
> ru.naumen.crm2.ui.tlc.CoreEmployeeTableListController.listMyDealsSorted(CoreEmployeeTableListController.java:70)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 11 months