hoaivan / QuizMarker

0 stars 0 forks source link

ko insert được question khi chưa ký tự đặc biệt #23

Closed hoaivan closed 12 years ago

hoaivan commented 12 years ago

Nhập nội dung chưa ký tự như: â đ etc ... ra exception này. => Cần support unicode!!!!!!!!!

Caused by: java.sql.BatchUpdateException: Incorrect string value: '\xC4\x91' for column 'title' at row 1 at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1257) at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:943) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268) ... 166 more 07:59:23,254 ERROR [render_portlet_jsp:154] java.sql.BatchUpdateException: Incorrect string value: '\xC4\x91' for column 'title' at row 1 at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1257) at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:943) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216) at com.liferay.portal.dao.orm.hibernate.SessionImpl.flush(SessionImpl.java:125) at com.liferay.portal.kernel.dao.orm.ClassLoaderSession.flush(ClassLoaderSession.java:218) at com.liferay.portal.service.persistence.BatchSessionImpl.update(BatchSessionImpl.java:95) at com.liferay.portal.service.persistence.BatchSessionUtil.update(BatchSessionUtil.java:49) at als.quizmarker.service.persistence.QuestionPersistenceImpl.updateImpl(QuestionPersistenceImpl.java:259) at als.quizmarker.service.persistence.QuestionPersistenceImpl.updateImpl(QuestionPersistenceImpl.java:1) at com.liferay.portal.service.persistence.impl.BasePersistenceImpl.update(BasePersistenceImpl.java:254) at com.liferay.portal.dao.shard.advice.ShardPersistenceAdvice.invoke(ShardPersistenceAdvice.java:52) at als.quizmarker.service.base.QuestionLocalServiceBaseImpl.addQuestion(QuestionLocalServiceBaseImpl.java:99) at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)

chungsavi commented 12 years ago

May biet cach nao de configure trong Build Service ko? bao cho tao biet luon di.

hoaivan commented 12 years ago

Ko cần sửa gì ở service builder cả. Tại khi gen json string unicode bị convert thành ascii nên break sql format thôi. Để nguyên unicode hoặc tìm cách escape ký tự sau khi bị convert là ok.

On Wed, Jul 11, 2012 at 5:32 PM, chungsavi < reply@reply.github.com

wrote:

May biet cach nao de configure trong Build Service ko? bao cho tao biet luon di.


Reply to this email directly or view it on GitHub: https://github.com/hoaivan/QuizMarker/issues/23#issuecomment-6903100

chungsavi commented 12 years ago

Tao check roi. Nguyen nhan la Character Encoding cua table va field. Ko lien quan den JSON dau.

hoaivan commented 12 years ago

tóm lại là cách fix cái này thế nào?

chungsavi commented 12 years ago

Service khi generate SQL de create tables phai ho tro Unicode. Nhung tao ko biet phai configure cho nao trong service Builder.

hoaivan commented 12 years ago

Sửa = tay trực tiếp vào mysql thì chỗ nào?

On Mon, Jul 16, 2012 at 10:43 AM, chungsavi < reply@reply.github.com

wrote:

Service khi generate SQL de create tables phai ho tro Unicode. Nhung tao ko biet phai configure cho nao trong service Builder.


Reply to this email directly or view it on GitHub: https://github.com/hoaivan/QuizMarker/issues/23#issuecomment-6997921

chungsavi commented 12 years ago

Tạm thời thay đổi trực tiếp trong database: Thay Collation của các table và các trường kiểu char/varchar dùng: utf8_unicode_ci

Các table:

quizmarker_answer,
quizmarker_exercise
quizmarker_exercisequestion
quizmarker_question
quizmarker_quizsession