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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:21:48+00:00 2026-05-19T14:21:48+00:00

I have a really strange problem. I’ve installed the spring-security-core 1.0.1 in my Grails

  • 0

I have a really strange problem. I’ve installed the spring-security-core 1.0.1 in my Grails 1.3.6 application and configured it according to the tutorial – tables are created orderly and populated by BootStrap.groovy. I’m using a PostgreSQL 8.4 database –the whole thing is running on my localhost. Now, the bootstrap works perfectly, but when I try to login I get an exception which says

org.hibernate.exception.SQLGrammarException: could not execute query

and further down:

Caused by: org.postgresql.util.PSQLException: ERROR: Column »username« does not exist

The query that fails is the following:

select
    authrole0_.id as id1_,
    authrole0_.version as version1_,
    authrole0_.authority as authority1_ 
from
    auth_role authrole0_ 
where
    username=?

and this is OK, because the auth_role table is not supposed to have username column. But why does Hibernate expect a username column, where it shouldn’t be one?

Any clues as how to resolve this?

I’ve tried two different hibernate diaclects with no effect. I’ve noticed that the mapping of the table is somehow curious – with the lookup table mapped as well. Unfortunately it says in the documentation of the plugin that I’m not supposed to change it, because the class is needed by the plugin.

My classes look like that:

class AuthUser {

    String username
    String password
    boolean active
    boolean accountExpired
    boolean accountLocked
    boolean passwordExpired

    static mapping = {
        cache true
        username column: '`username`'
        password column: '`password`'
    }

    Set<AuthRole> getAuthorities() {
        UserRole.findAllByUser(this).collect { it.role } as Set
    }
}

import java.util.Set;

class AuthRole {

String authority

static constraints = {
    authority blank: false, unique: true
}
  }

  import org.apache.commons.lang.builder.HashCodeBuilder

class UserRole implements Serializable {

    AuthRole role
    AuthUser user

    boolean equals(other) {
        if (!(other instanceof UserRole)) {
            return false
        }

        other.user?.id == user?.id &&
                other.role?.id == role?.id
    }

    int hashCode() {
        def builder = new HashCodeBuilder()
        if (role) builder.append(role.id)
        if (user) builder.append(user.id)
        builder.toHashCode()
    }

    static UserRole get(long roleId, long userId) {
        find 'from UserRole where role.id=:roleId and user.id=:userId',
                [roleId: roleId, userId: userId]
    }

    static UserRole create(AuthRole role, AuthUser user, boolean flush = false) {
        new UserRole(role: role, user: user).save(flush: flush, insert: true)
    }

    static boolean remove(AuthRole role, AuthUser user, boolean flush = false) {
        UserRole instance = UserRole.findByRoleAndUser(role, user)
        instance ? instance.delete(flush: flush) : false
    }

    static void removeAll(AuthRole role) {
        executeUpdate 'DELETE FROM UserRole WHERE role=:role', [role: role]
    }

    static void removeAll(AuthUser user) {
        executeUpdate 'DELETE FROM UserRole WHERE user=:user', [user: user]
    }

    static mapping = {
        id composite: ['user', 'role']
        version false
    }
}

They are pretty much the way the plugin created them.

Thanks,
al

  • 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-19T14:21:49+00:00Added an answer on May 19, 2026 at 2:21 pm

    OK, found it – “enabled” is a default value. In my class I defined “active” instead of “enabled”.

    Seems that the plugin is really touchy, when it comes to customizing 😉

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

Sidebar

Related Questions

I have a really strange issue. I am working on a Java SWING application
I've come across a really strange problem. I have written a simple Deck class
I am having some strange problem and its really frustating me. I have a
I have a really strange problem with the standard logging module used in django
I have this really strange problem where my entity framework query isn't enumerating correctly.
So this is a really strange problem. I have a Java app that acts
This is a really strange problem I'm seeing in my app. I have an
I am facing a really strange problem with Core Data. Let's describe it: Definitions
I have a really strange problem that I can't explain and fix, it is
I have a really strange problem, following attribute of a jsp tag <custom:tag onclick=addBid('<%=

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.