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

  • SEARCH
  • Home
  • 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 8628089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:26:53+00:00 2026-06-12T08:26:53+00:00

I wanna register a user using Spring MVC 3, Hibernate, and PostgresQL. Here Is

  • 0

I wanna register a user using Spring MVC 3, Hibernate, and PostgresQL.
Here Is the form I wanna submit:

<form:form name="registerForm" method="post"
        action="registerNewUser.html" commandName="user">

        <table>

            <tr>
                <td><spring:message code="label.userName" /></td>
                <td><form:input path="userName" /></td>
                <td><form:errors path="userName" cssClass="error" /></td>
            </tr>

            <tr>
                <td><spring:message code="label.password" /></td>
                <td><form:password path="password" /></td>
                <td><form:errors path="password" cssClass="error" /></td>
            </tr>


            <tr>
                <td><spring:message code="label.password" /></td>
                <td><form:password path="retypePassword" /></td>
                <td><form:errors path="retypePassword" cssClass="error" /></td>
            </tr>

            <tr>
                <td colspan="2"><input type="submit"
                    value="<spring:message code="register.label" />" /></td>
            </tr>
        </table>

    </form:form>

here is the POJO I want to save:

@Entity
@Table(name = "user_table")
public class User {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    @Column(name = "user_name", nullable = false, length = 50)
    private String userName;

    @Column(name = "password", nullable = false, length = 50)
    private String password;

    private String retypePassword;
        // getters setters

and here is the relevant part of the Controller:

@RequestMapping(value = "/registerNewUser", method = RequestMethod.POST)
public String saveNewUser(@ModelAttribute User user, BindingResult result, Model model, HttpSession session) {

    UserValidator validator = new UserValidator();
    validator.validateUser(user, result, userService.existingUser(user));
    String ret = REGISTER_USER;
    if (!result.hasErrors()) {
        user.setPassword(PasswordEncripter.md5(user.getPassword()));
        userService.save(user);
        ret = goToPractice(user, model, session);
    }
    return ret;
}

Because I feel it wasteful to store the value of retypePassword in the DB I did not create a column for that.
That caused the exception below when I submitted the form:

org.postgresql.util.PSQLException: ERROR: column user0_.retypepassword does not exist

I could easily fix this exception by adding the column “retypePassword” to the table but I still feel that would be wasteful. Is there any clever way to fix the problem without adding duplicate data in the DB?

  • 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-06-12T08:26:54+00:00Added an answer on June 12, 2026 at 8:26 am

    You can mark retypePassword in entity with @Transient, this will instruct hibernate not to create column in table but still you can use this pojo to bind with spring mvc for validation purpose.

    @Entity
    @Table(name = "user_table")
    public class User {
    
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Column(name = "id")
        private Long id;
    
        @Column(name = "user_name", nullable = false, length = 50)
        private String userName;
    
        @Column(name = "password", nullable = false, length = 50)
        private String password;
    
        @Transient
        private String retypePassword;
            // getters setters
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanna validate an input of password <form name=regist action=proc/regist.php onsubmit=return validate_form1() method=post> <p>Your
I'm using MVC3 with razor and I wanna make a registration form where I
i wanna do a single selection in my table view here is my code
I wanna run selenium tests from TeamCity using Maven at Linux server without display.
I wanna to detect an input tag that its name is: some[en] in jquery.
I wanna start using Google Analytics PHP API. I found 2 libraries and I
I wanna implement an interface(Add behavior) for set of WPF usercontrols. I'm using MVVM
I wanna create a server control like the following : <%@ Register Assembly=MdsAccordionMenu Namespace=MdsAccordionMenu
I wanna diplay a Stopwatch timer... using Asp.Net C#... I have looked through many
i wanna make my own application to reach my mails. i'm using office 365

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.