Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Incorrect string value: '\xAC\xED\x00\x05ur...' for column
PostPosted: Mon Nov 06, 2017 6:51 am 
Beginner
Beginner

Joined: Tue Aug 08, 2017 12:14 am
Posts: 31
Hi experts,

I need some help in explaining why I am getting the extracted value when I have entered the right value as per the database.

And because I am getting null the servlet is giving me a java.lang.NullPointerException.

Here's the full stacktrace :

Code:
2017-Nov-06 18:45:54 PM [http-nio-8013-exec-6] INFO  org.hibernate.Version - HHH000412: Hibernate Core {5.0.0.Final}
2017-Nov-06 18:45:55 PM [http-nio-8013-exec-6] INFO  org.hibernate.cfg.Environment - HHH000206: hibernate.properties not found
2017-Nov-06 18:45:55 PM [http-nio-8013-exec-6] INFO  org.hibernate.cfg.Environment - HHH000021: Bytecode provider name : javassist
2017-Nov-06 18:45:56 PM [http-nio-8013-exec-6] INFO  org.hibernate.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {5.0.0.Final}
2017-Nov-06 18:45:56 PM [http-nio-8013-exec-6] WARN  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl - HHH000402: Using Hibernate built-in connection pool (not for production use!)
2017-Nov-06 18:45:56 PM [http-nio-8013-exec-6] INFO  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl - HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/hi5]
2017-Nov-06 18:45:56 PM [http-nio-8013-exec-6] INFO  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl - HHH000046: Connection properties: {user=root, password=****}
2017-Nov-06 18:45:56 PM [http-nio-8013-exec-6] INFO  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl - HHH000006: Autocommit mode: false
2017-Nov-06 18:45:56 PM [http-nio-8013-exec-6] INFO  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl - HHH000115: Hibernate connection pool size: 20 (min=1)
2017-Nov-06 18:45:56 PM [http-nio-8013-exec-6] INFO  org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
2017-Nov-06 18:46:01 PM [http-nio-8013-exec-6] INFO  org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000228: Running hbm2ddl schema update
2017-Nov-06 18:46:02 PM [http-nio-8013-exec-6] INFO  org.hibernate.hql.internal.QueryTranslatorFactoryInitiator - HHH000397: Using ASTQueryTranslatorFactory
2017-Nov-06 18:46:03 PM [http-nio-8013-exec-6] DEBUG org.hibernate.SQL - select user0_.Id as Id1_4_, user0_.city as city2_4_, user0_.email as email3_4_, user0_.password1 as password4_4_, user0_.phone as phone5_4_, user0_.userId as userId6_4_ from user user0_ where user0_.userId='karengsh'
Hibernate: select user0_.Id as Id1_4_, user0_.city as city2_4_, user0_.email as email3_4_, user0_.password1 as password4_4_, user0_.phone as phone5_4_, user0_.userId as userId6_4_ from user user0_ where user0_.userId='karengsh'
2017-Nov-06 18:46:03 PM [http-nio-8013-exec-6] TRACE org.hibernate.type.descriptor.sql.BasicExtractor - extracted value ([Id1_4_] : [INTEGER]) - [1]
2017-Nov-06 18:46:03 PM [http-nio-8013-exec-6] TRACE org.hibernate.type.descriptor.sql.BasicExtractor - extracted value ([city2_4_] : [VARCHAR]) - [Singapore]
2017-Nov-06 18:46:03 PM [http-nio-8013-exec-6] TRACE org.hibernate.type.descriptor.sql.BasicExtractor - extracted value ([email3_4_] : [VARCHAR]) - [karenworld@yahoo.com]
2017-Nov-06 18:46:03 PM [http-nio-8013-exec-6] TRACE org.hibernate.type.descriptor.sql.BasicExtractor - extracted value ([password4_4_] : [VARCHAR]) - [null]
2017-Nov-06 18:46:03 PM [http-nio-8013-exec-6] TRACE org.hibernate.type.descriptor.sql.BasicExtractor - extracted value ([phone5_4_] : [VARCHAR]) - [81382852]
2017-Nov-06 18:46:03 PM [http-nio-8013-exec-6] TRACE org.hibernate.type.descriptor.sql.BasicExtractor - extracted value ([userId6_4_] : [VARCHAR]) - [karengsh]
Nov 06, 2017 6:46:03 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [controller.LoginServlet] in context with path [/Hi5S] threw exception
java.lang.NullPointerException
   at Business.LoginService.authenticateUser(LoginService.java:18)
   at controller.LoginServlet.doPost(LoginServlet.java:28)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
   at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
   at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
   at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
   at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
   at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
   at java.lang.Thread.run(Unknown Source)


Top
 Profile  
 
 Post subject: Re: Why extracted value is null when it is correct ?
PostPosted: Mon Nov 06, 2017 7:40 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1534
Location: Romania
Code:
2017-Nov-06 18:46:03 PM [http-nio-8013-exec-6] TRACE org.hibernate.type.descriptor.sql.BasicExtractor - extracted value ([password4_4_] : [VARCHAR]) - [null]


Maybe it's null in the DB as well.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: Why extracted value is null when it is correct ?
PostPosted: Tue Nov 07, 2017 9:47 am 
Beginner
Beginner

Joined: Tue Aug 08, 2017 12:14 am
Posts: 31
vlad wrote:
Code:
2017-Nov-06 18:46:03 PM [http-nio-8013-exec-6] TRACE org.hibernate.type.descriptor.sql.BasicExtractor - extracted value ([password4_4_] : [VARCHAR]) - [null]


Maybe it's null in the DB as well.


Hi,

It is the same thing with my another form.

I have entered the contact number but it gives me a null where as other parameters have no problem. Please let me know how to rectify the problem.

Here's the error (Please ignore about other errors like the subjects which I need to fix the code)

Code:
2017-Nov-07 21:41:06 PM [http-nio-8013-exec-8] INFO  org.hibernate.Version - HHH000412: Hibernate Core {5.0.0.Final}
2017-Nov-07 21:41:06 PM [http-nio-8013-exec-8] INFO  org.hibernate.cfg.Environment - HHH000206: hibernate.properties not found
2017-Nov-07 21:41:06 PM [http-nio-8013-exec-8] INFO  org.hibernate.cfg.Environment - HHH000021: Bytecode provider name : javassist
2017-Nov-07 21:41:08 PM [http-nio-8013-exec-8] INFO  org.hibernate.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {5.0.0.Final}
2017-Nov-07 21:41:09 PM [http-nio-8013-exec-8] WARN  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl - HHH000402: Using Hibernate built-in connection pool (not for production use!)
2017-Nov-07 21:41:09 PM [http-nio-8013-exec-8] INFO  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl - HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/hi5]
2017-Nov-07 21:41:09 PM [http-nio-8013-exec-8] INFO  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl - HHH000046: Connection properties: {user=root, password=****}
2017-Nov-07 21:41:09 PM [http-nio-8013-exec-8] INFO  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl - HHH000006: Autocommit mode: false
2017-Nov-07 21:41:09 PM [http-nio-8013-exec-8] INFO  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl - HHH000115: Hibernate connection pool size: 20 (min=1)
2017-Nov-07 21:41:09 PM [http-nio-8013-exec-8] INFO  org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
2017-Nov-07 21:41:13 PM [http-nio-8013-exec-8] INFO  org.hibernate.tuple.PojoInstantiator - HHH000182: No default (no-argument) constructor for class: model.Tutor (class must be instantiated by Interceptor)
2017-Nov-07 21:41:13 PM [http-nio-8013-exec-8] INFO  org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000228: Running hbm2ddl schema update
2017-Nov-07 21:41:15 PM [http-nio-8013-exec-8] INFO  org.hibernate.hql.internal.QueryTranslatorFactoryInitiator - HHH000397: Using ASTQueryTranslatorFactory
2017-Nov-07 21:41:15 PM [http-nio-8013-exec-8] DEBUG org.hibernate.SQL - select tutor_.tutor_id, tutor_.tutorNRIC as tutorNRI2_2_, tutor_.tutorAddress1 as tutorAdd3_2_, tutor_.tutorAddress2 as tutorAdd4_2_, tutor_.tutorAge as tutorAge5_2_, tutor_.tutorRates as tutorRat6_2_, tutor_.tutorContactNo as tutorCon7_2_, tutor_.tutorEmail as tutorEma8_2_, tutor_.tutorGender as tutorGen9_2_, tutor_.tutorName as tutorNa10_2_, tutor_.tutorQualification as tutorQu11_2_, tutor_.tutorQualficationDetail as tutorQu12_2_, tutor_.tutorRemarks as tutorRe13_2_, tutor_.subjMany as subjMan14_2_, tutor_.zipcode as zipcode15_2_ from tutor tutor_ where tutor_.tutor_id=?
Hibernate: select tutor_.tutor_id, tutor_.tutorNRIC as tutorNRI2_2_, tutor_.tutorAddress1 as tutorAdd3_2_, tutor_.tutorAddress2 as tutorAdd4_2_, tutor_.tutorAge as tutorAge5_2_, tutor_.tutorRates as tutorRat6_2_, tutor_.tutorContactNo as tutorCon7_2_, tutor_.tutorEmail as tutorEma8_2_, tutor_.tutorGender as tutorGen9_2_, tutor_.tutorName as tutorNa10_2_, tutor_.tutorQualification as tutorQu11_2_, tutor_.tutorQualficationDetail as tutorQu12_2_, tutor_.tutorRemarks as tutorRe13_2_, tutor_.subjMany as subjMan14_2_, tutor_.zipcode as zipcode15_2_ from tutor tutor_ where tutor_.tutor_id=?
2017-Nov-07 21:41:15 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [1] as [INTEGER] - [0]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] DEBUG org.hibernate.SQL - insert into tutor (tutorNRIC, tutorAddress1, tutorAddress2, tutorAge, tutorRates, tutorContactNo, tutorEmail, tutorGender, tutorName, tutorQualification, tutorQualficationDetail, tutorRemarks, subjMany, zipcode, tutor_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into tutor (tutorNRIC, tutorAddress1, tutorAddress2, tutorAge, tutorRates, tutorContactNo, tutorEmail, tutorGender, tutorName, tutorQualification, tutorQualficationDetail, tutorRemarks, subjMany, zipcode, tutor_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [1] as [VARCHAR] - [S78123456K]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [2] as [VARCHAR] - [23 Java Street]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [3] as [VARCHAR] - [Jupiter Building]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [4] as [INTEGER] - [35]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [5] as [VARCHAR] - [null]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [6] as [VARCHAR] - [null]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [7] as [VARCHAR] - [doreen_koh@yahoo.com]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [8] as [VARCHAR] - [Female]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [9] as [VARCHAR] - [Doreen Koh]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [10] as [VARCHAR] - [Degree in Maths]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [11] as [VARCHAR] - [NTU]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [12] as [VARCHAR] - [aaa]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [13] as [VARBINARY] - [null]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [14] as [VARCHAR] - [680122]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [15] as [INTEGER] - [0]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] WARN  org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 1048, SQLState: 23000
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Column 'tutorRates' cannot be null
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] INFO  org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl - HHH000010: On release of batch it still contained JDBC statements
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] ERROR org.hibernate.internal.SessionImpl - HHH000346: Error during managed flush [could not execute statement]
org.hibernate.exception.ConstraintViolationException: could not execute statement
   at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:59)
   at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
   at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
   at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95)
   at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:207)
   at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:45)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2823)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3323)
   at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:89)
   at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:447)
   at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:333)
   at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:335)
   at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
   at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1224)
   at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:464)
   at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:2890)
   at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2266)
   at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:485)
   at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:146)
   at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$100(JdbcResourceLocalTransactionCoordinatorImpl.java:38)
   at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:230)
   at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:65)
   at Business.RegisterService.register(RegisterService.java:24)
   at controller.tutorController.doPost(tutorController.java:63)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
   at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
   at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
   at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
   at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
   at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
   at java.lang.Thread.run(Unknown Source)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'tutorRates' cannot be null
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
   at com.mysql.jdbc.Util.getInstance(Util.java:387)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:934)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3870)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3806)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2470)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2617)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2550)
   at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
   at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2073)
   at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2009)
   at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5094)
   at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1994)
   at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:204)
   ... 43 more
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] DEBUG org.hibernate.SQL - select subject_.sub_id, subject_.subj as subj2_0_, subject_.subjectName as subjectN3_0_ from subject subject_ where subject_.sub_id=?
Hibernate: select subject_.sub_id, subject_.subj as subj2_0_, subject_.subjectName as subjectN3_0_ from subject subject_ where subject_.sub_id=?
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [1] as [INTEGER] - [0]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] DEBUG org.hibernate.SQL - insert into subject (subj, subjectName, sub_id) values (?, ?, ?)
Hibernate: insert into subject (subj, subjectName, sub_id) values (?, ?, ?)
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [1] as [VARCHAR] - [null]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [2] as [VARBINARY] - [[Ljava.lang.String;@4bd8f87b]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] TRACE org.hibernate.type.descriptor.sql.BasicBinder - binding parameter [3] as [INTEGER] - [0]
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] WARN  org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 1366, SQLState: HY000
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Incorrect string value: '\xAC\xED\x00\x05ur...' for column 'subjectName' at row 1
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] INFO  org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl - HHH000010: On release of batch it still contained JDBC statements
2017-Nov-07 21:41:16 PM [http-nio-8013-exec-8] ERROR org.hibernate.internal.SessionImpl - HHH000346: Error during managed flush [could not execute statement]
org.hibernate.exception.GenericJDBCException: could not execute statement
   at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
   at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
   at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95)
   at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:207)
   at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:45)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2823)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3323)
   at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:89)
   at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:447)
   at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:333)
   at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:335)
   at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
   at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1224)
   at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:464)
   at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:2890)
   at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2266)
   at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:485)
   at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:146)
   at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$100(JdbcResourceLocalTransactionCoordinatorImpl.java:38)
   at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:230)
   at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:65)
   at controller.tutorController.doPost(tutorController.java:94)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
   at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
   at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
   at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
   at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
   at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: Incorrect string value: '\xAC\xED\x00\x05ur...' for column 'subjectName' at row 1
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:959)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3870)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3806)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2470)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2617)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2550)
   at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
   at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2073)
   at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2009)
   at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5094)
   at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1994)
   at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:204)
   ... 42 more



Top
 Profile  
 
 Post subject: Re: Why extracted value is null when it is correct ?
PostPosted: Tue Nov 07, 2017 11:04 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1534
Location: Romania
Quote:
Incorrect string value: '\xAC\xED\x00\x05ur...' for column 'subjectName' at row 1


Check out this StackOverflow answer. It tells you how to fix your issue.

Most likely, it's an encoding issue. Make sure you use UTF-8 from browser, to web server and the database too.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: Why extracted value is null when it is correct ?
PostPosted: Tue Nov 07, 2017 10:19 pm 
Beginner
Beginner

Joined: Tue Aug 08, 2017 12:14 am
Posts: 31
I re-built my database and the password is working now.


Top
 Profile  
 
 Post subject: Re: Why extracted value is null when it is correct ?
PostPosted: Mon Nov 13, 2017 8:21 am 
Beginner
Beginner

Joined: Tue Aug 08, 2017 12:14 am
Posts: 31
vlad wrote:
Quote:
Incorrect string value: '\xAC\xED\x00\x05ur...' for column 'subjectName' at row 1


Check out this StackOverflow answer. It tells you how to fix your issue.

Most likely, it's an encoding issue. Make sure you use UTF-8 from browser, to web server and the database too.


Hi,

I have altered my table to use utf8_general_ci from utf8.
The subject table contains sub_id and subjMany respectively.
I only alatered subjMany.

ALTER TABLE subject MODIFY COLUMN subjMany VARCHAR(55)
CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

It is not helping and I am still getting the same error.

I wonder if it is because I am reading an array ?

Here's my subject class :

Code:
package model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;


@Entity (name = "subject")
@Table(name = "subject")
public class Subject implements Serializable {

   /**
    *
    */
   private static final long serialVersionUID = 1L;
   
   @ManyToMany(mappedBy = "subjects")
   @ElementCollection
   private List<Tutor> tutors = new ArrayList<>();

   @Id      
   @Column(name = "sub_id")
   private int sub_id;

   private String subj;
   
   public Subject() {
      // TODO Auto-generated constructor stub
   }

   public Subject(int sub_id, String[]subjMany){
      this.sub_id = sub_id;
      this.subjMany = subjMany;
   }
   
   @Column(name = "subjMany")
   private String[] subjMany;

   public String[] getSubjMany() {
      return subjMany;
   }

   public void setSubjMany(String[] subjMany) {
      this.subjMany = subjMany;
   }

   //public Subject(int sub_id, String subj) {
      //this.sub_id = sub_id;
      //this.subj = subj;
   //}

   public List<Tutor> getTutors() {
      return tutors;
   }

   public void setTutors(List<Tutor> tutors) {
      this.tutors = tutors;
   }

   
   
   public int getSub_id() {
      return sub_id;
   }

   public void setSub_id(int sub_id) {
      this.sub_id = sub_id;
   }

   
   @Override
   public boolean equals (Object o){
      if (this == o){
         return true;         
      }
      if (o == null || getClass() != o.getClass()) {
         return false;
      }
      Subject s = (Subject)o;
      return Objects.equals(sub_id, s.sub_id) &&
            Objects.equals(subjMany, s.subjMany);
      }
   

   
   @Override
   public String toString() {
      return "Subject [sub_id=" + sub_id + " + subjMany ]";
   }
}



and in my tutor class I have added the subject like this :

Code:
@Column(name="tutorRates")
   @NotNull
   private String budget;
   
   @Column(name="tutorRemarks")
   private String remark;
   
   String[] subjMany;// I am using String[] subjMany to getParameterValues
      
   @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})   
   private List<Subject>subjects = new ArrayList<>();
   
   public List<Subject> getSubjects() {
      return subjects;
   }
   public void setSubjects(List<Subject> subjects) {
      this.subjects = subjects;
   }
   
   //public void addSubject(Subject subject) {
      //  this.subjects.add(subject);
    //}
   
   public void addSubject(Subject subject){
      subjects.add(subject);
      subject.getTutors().add(this);
   }
   
   public void removeSubject(Subject subject){
      subjects.remove(subject);
      subject.getTutors().remove(this);
   }
   
   public String[] getSubjMany() {
      return subjMany;
   }
   public void setSubjMany(String[] subjMany) {
      this.subjMany = subjMany;
   }


Kindly let me know if there is anything amiss.

Thank you again.


Top
 Profile  
 
 Post subject: Re: Incorrect string value: '\xAC\xED\x00\x05ur...' for column
PostPosted: Mon Nov 13, 2017 8:34 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1534
Location: Romania
You really need to read the Hibernate User Guide.

After you read it, you will understand why this mapping cannot work:

Code:
@Column(name = "subjMany")
private String[] subjMany;

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.