• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S Update Method Data too long

 
Dave Rodger
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

There is a fixed amount of data that can be written to each of the fields in the database. Obviously if one of the fields in the data[] is too long to fit into the database record (without writing onto the next field) an exception should be thrown. The only exception that is listed in the interface is the RecordNotFoundException however throwing this type of exception does not seem the correct solution. However I understand that no additional exceptions may be added to Sun's Data interface. Should I throw an unchecked RuntimeException instead?

Thanks
 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dave,

Welcome to the JavaRanch!

I threw an IllegalArgumentException when the value of a field was too long (according to database schema). Other people (like Roberto Perillo) just used the substring-method to make the string the appropriate length.

Kind regards,
Roel
 
Dave Rodger
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks!
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:Other people (like Roberto Perillo) just used the substring-method to make the string the appropriate length.


Exactly!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic