• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bodgitt and Scarper create method

 
Glen Iris
Ranch Hand
Posts: 172
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey All,

In the B&S interface which I must implement, there exists a create method with an int return type. The requirements do not state that the program requires the ability to add new records to the db.

From reading through other threads on here, I know I must write the code for the method even though my program will not use it.

What is the best way to indicate that the creation of a new record failed (for any reason)? The return type is int so I cannot return null. The return type int is supposed to indicate the new record number. What if there is no new record number as the operation has failed? I was thinking of returning -1.

Any Thoughts?
 
Roel De Nijs
Sheriff
Posts: 9934
113
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Returning a negative number is a possibility. Returning a (runtime) exception could be another one.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic