Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Company Name is limited to 100 characters by DB, but text box allows more and thowing error

 
tej ku
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

How to restrict a field length to 100?

Please reference the following message when reporting this error
com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -302, SQLSTATE: 22001, SQLERRMC: null


application or the network may be experiencing technical difficulties.
Click here to re-enter the application.
Or: Contact Tech Support for assistance.







Exception Stack Trace:
com.ibm.db2.jcc.a.kg:1411 dcom.ibm.db2.jcc.c.kb:367 lcom.ibm.db2.jcc.c.kb:64 acom.ibm.db2.jcc.c.w:48 acom.ibm.db2.jcc.c.ec:302 bcom.ibm.db2.jcc.a.lg:1764 dbcom.ibm.db2.jcc.a.lg:2367 dcom.ibm.db2.jcc.a.lg:550 Ycom.ibm.db2.jcc.a.lg:533 executeUpdatecom.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement:1081 pmiExecuteUpdatecom.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement:748 executeUpdateorg.hibernate.jdbc.NonBatchingBatcher:46 addToBatchorg.hibernate.persister.entity.AbstractEntityPersister:2431 updateorg.hibernate.persister.entity.AbstractEntityPersister:2335 updateOrInsertorg.hibernate.persister.entity.AbstractEntityPersister:2635 updateorg.hibernate.action.EntityUpdateAction:115 executeorg.hibernate.engine.ActionQueue:279 executeorg.hibernate.engine.ActionQueue:263 executeActionsorg.hibernate.engine.ActionQueue:168 executeActionsorg.hibernate.event.def.AbstractFlushingEventListener:321 performExecutionsorg.hibernate.event.def.DefaultFlushEventListener:50 onFlushorg.hibernate.impl.SessionImpl:1027 flushorg.springframework.orm.hibernate3.SpringSessionSynchronization:135 beforeCommitorg.springframework.transaction.support.TransactionSynchronizationUtils:72 triggerBeforeCommitorg.springframework.transaction.support.AbstractPlatformTransactionManager:905 triggerBeforeCommitorg.springframework.transaction.support.AbstractPlatformTransactionManager:715 processCommitorg.springframework.transaction.support.AbstractPlatformTransactionManager:701 commitorg.jboss.seam.ioc.spring.SpringTransaction:124 commitorg.jboss.seam.jsf.SeamPhaseListener:614 commitOrRollbackorg.jboss.seam.jsf.SeamPhaseListener:605 commitOrRollbackorg.jboss.seam.jsf.SeamPhaseListener:343 handleTransactionsAfterPhaseorg.jboss.seam.jsf.SeamPhaseListener:243 afterServletPhaseorg.jboss.seam.jsf.SeamPhaseListener:194 afterPhasecom.sun.faces.lifecycle.Phase:175 handleAfterPhasecom.sun.faces.lifecycle.Phase:114 doPhasecom.sun.faces.lifecycle.LifecycleImpl:118 executejavax.faces.webapp.FacesServlet:265 servicecom.ibm.ws.webcontainer.servlet.ServletWrapper:1146 servicecom.ibm.ws.webcontainer.servlet.ServletWrapper:1087 servicecom.ibm.ws.webcontainer.filter.WebAppFilterChain:145 doFiltergov.state.oh.us.odjfs.rcx.filter.RequestFilter:123 doFiltercom.ibm.ws.webcontainer.filter.FilterInstanceWrapper:190 doFiltercom.ibm.ws.webcontainer.filter.WebAppFilterChain:130 doFilterorg.jboss.seam.web.ExceptionFilter:64 doFiltercom.ibm.ws.webcontainer.filter.FilterInstanceWrapper:190 doFiltercom.ibm.ws.webcontainer.filter.WebAppFilterChain:130 doFilterorg.jboss.seam.servlet.SeamFilter$FilterChainImpl:83 doFilterorg.jboss.seam.web.IdentityFilter:40 doFilterorg.jboss.seam.servlet.SeamFilter$FilterChainImpl:69 doFilterorg.jboss.seam.web.MultipartFilter:90 doFilterorg.jboss.seam.servlet.SeamFilter$FilterChainImpl:69 doFilterorg.jboss.seam.web.RedirectFilter:45 doFilterorg.jboss.seam.servlet.SeamFilter$FilterChainImpl:69 doFilterorg.jboss.seam.web.ExceptionFilter:64 doFilterorg.jboss.seam.servlet.SeamFilter$FilterChainImpl:69 doFilterorg.ajax4jsf.webapp.BaseFilter:510 doFilterorg.jboss.seam.web.Ajax4jsfFilter:56 doFilterorg.jboss.seam.servlet.SeamFilter$FilterChainImpl:69 doFilterorg.jboss.seam.web.LoggingFilter:58 doFilterorg.jboss.seam.servlet.SeamFilter$FilterChainImpl:69 doFilterorg.jboss.seam.servlet.SeamFilter:158 doFiltercom.ibm.ws.webcontainer.filter.FilterInstanceWrapper:190 doFiltercom.ibm.ws.webcontainer.filter.WebAppFilterChain:130 doFilterorg.ajax4jsf.webapp.BaseXMLFilter:178 doXmlFilterorg.ajax4jsf.webapp.BaseFilter:290 handleRequestorg.ajax4jsf.webapp.BaseFilter:368 processUploadsAndHandleRequestorg.ajax4jsf.webapp.BaseFilter:495 doFiltercom.ibm.ws.webcontainer.filter.FilterInstanceWrapper:190 doFiltercom.ibm.ws.webcontainer.filter.WebAppFilterChain:130 doFiltercom.ibm.ws.webcontainer.filter.WebAppFilterChain:87 _doFiltercom.ibm.ws.webcontainer.filter.WebAppFilterManager:837 doFiltercom.ibm.ws.webcontainer.filter.WebAppFilterManager:680 doFiltercom.ibm.ws.webcontainer.servlet.ServletWrapper:588 handleRequestcom.ibm.ws.wswebcontainer.servlet.ServletWrapper:481 handleRequestcom.ibm.ws.webcontainer.servlet.CacheServletWrapper:90 handleRequestcom.ibm.ws.webcontainer.WebContainer:748 handleRequestcom.ibm.ws.wswebcontainer.WebContainer:1466 handleRequestcom.ibm.ws.webcontainer.channel.WCChannelLink:122 readycom.ibm.ws.http.channel.inbound.impl.HttpInboundLink:458 handleDiscriminationcom.ibm.ws.http.channel.inbound.impl.HttpInboundLink:387 handleNewInformationcom.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback:102 completecom.ibm.ws.tcp.channel.impl.AioReadCompletionListener:165 futureCompletedcom.ibm.io.async.AbstractAsyncFuture:217 invokeCallbackcom.ibm.io.async.AsyncChannelFuture:161 fireCompletionActionscom.ibm.io.async.AsyncFuture:136 completedcom.ibm.io.async.ResultHandler:196 completecom.ibm.io.async.ResultHandler:751 runEventProcessingLoopcom.ibm.io.async.ResultHandler$2:881 runcom.ibm.ws.util.ThreadPool$Worker:1497 run




 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you asking how to set the maxlength allowed by an HTML text input box?

In any case--that's not good enough: the length still needs to be validated on the server side--how are you currently validating?

You *could* do something with a Hibernate type converter, I suppose, but ew.

In any case, I don't see this as being a Hibernate issue.
 
chets patel
Ranch Hand
Posts: 77
Eclipse IDE Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Straight away check the length of the string using comapanyName.length()
 
Mohit Kumar Tayal
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
before inserting the value into the databse check length and take appropriate action as either reenter from the user and abort the processing or you can substring to length to truncate more characters from string and then insert.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic