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 7415991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:24:16+00:00 2026-05-29T07:24:16+00:00

This is my entity class and login code. My last login remains null in

  • 0

This is my entity class and login code. My last login remains null in db with no exception thrown. i tried logging the hibernate sql statements. It seem that the update statement isn’t executed…

entity:

class Users {
  static hasMany = [farm:Farms,report:Reports,reportMessage:ReportMessages,notifications:Notifications]

  String userName 
  String Password
  Date lastLogin
  String userImage

  static constraints = {
    userName (blank:false, unique:true)
    Password (blank:false)
    userImage (blank:false)
    lastLogin (nullable:true, blank:true)
  }
}

login code

def login(user)
{
    def status = false;        
    Users u = user;
    Users users = Users.findByUserName(u.userName)
    PasswordCodec pwd = new PasswordCodec();
    u.Password = pwd.encode(u.Password)
    if (users !=null && u.Password.equals(users.Password))
    {
        u.lastLogin = new Date()
        u.save()
        status = true
    }
}
  • 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-29T07:24:16+00:00Added an answer on May 29, 2026 at 7:24 am

    It looks like you are assigning the lastLogin date to the command object passed with the request. The stored domain object seems not to be updated:

    u.lastLogin = new Date()
    u.save()
    

    should be replaced by

    users.lastLogin = new Date()
    users.save()
    

    Hope that helps.

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

Sidebar

Related Questions

Let's say I have this entity (for Hibernate): @Entity public class Person { @Id
I have this code for login validation using a Struts2 action class which calls
I have entity model like this (using EclipseLink and JPA 2.0): @Entity class A
I have a variable declared like this in a class: Entity *array[BOARD_SIZE][BOARD_SIZE]; I need
I have a Person and an Organisation Entity: Person looks like this: public class
This code works for my simple testing login form. It uses POST to log
I'm having an entity object called Patient and this entity is having a property
I have a JPA object which has a many-to-many relationship like this: @Entity public
I try to use this mapping : @Entity @Table(name=ecc.\RATE\) @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name=DISCRIMINATOR, discriminatorType= DiscriminatorType.STRING) public
nobody loved my first question about this: Creating Entity Framework objects with Unity for

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.