Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6007325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:39:53+00:00 2026-05-23T01:39:53+00:00

I am trying out a web app using servlets and jsps and need to

  • 0

I am trying out a web app using servlets and jsps and need to model isbn number of an item in my class as well as in hibernate mappings.
Which should be the type of an isbn number?Long or String? I had come across many tutorials that use either of them..
isbn is supposedly a 10 digit identifier..sometimes you come across numbers like 0-85131-041-9 which cannot be a Long ..Some examples use numbers without hyphens..

So,which should be the type? Any suggestions?

thanks

mark

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:39:54+00:00Added an answer on May 23, 2026 at 1:39 am

    I’d store it in a Long property and use a formatter/parser (essentially, a converter). When you’re going to display it, the converter should just convert the Long property to a human representation with hyphens in the right places. When you’re going to validate/persist it, the converter should remove all hyphens from the submitted value and put it in a Long property.

    Basically, it’s the same idea as you would use for a Date field which you format/parse in the human representation with help of SimpleDateFormat. The only difference is that the ISBN formatter/parser isn’t available by the standard Java SE API. You’d need to write one yourself or to adopt a 3rd party one (of which none existing comes to mind though). Finally this converter can then be used as a JSP tag (like JSTL’s <fmt:formatDate>) or a standalone Java class which is invoked by an EL function or when you’re using JSF, a @FacesConverter class.

    Due to the complexiteit of the ISBN number, this is indeed more than often stored as a String so that the developer doesn’t need to worry about valid patterns. Whether that’s good or bad is a question that you’ve to ask yourself and your team.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to figure out why my web app (I didn't write it, but
I am trying to figure out how to click a button on a web
I am trying to find out how to upload a file from a web
I am trying to figure out the best way in an asmx web service
I'm trying to work out a way of passing the web current http context
Visual Studio makes calling a web service easy, trying to figure out what is
I'm thinking about trying out MVC later today for a new app we're starting
I'm trying to add a remember me feature to my web app to let
At work we have a web app that we'll need to interface with another
I'm trying to deploy a web service onto WebSphere using a WAR file, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.