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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:30:34+00:00 2026-06-15T23:30:34+00:00

Grails supports the mapping of basic collection types, for example: static hasMany = [nicknames:

  • 0

Grails supports the mapping of basic collection types, for example:

static hasMany = [nicknames: String]

So what exactly is the difference between doing the above vs just adding an array (or list) of type String to the domain class – i.e.

List<String> nicknames 
  • 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-15T23:30:35+00:00Added an answer on June 15, 2026 at 11:30 pm

    The difference is that with just:

    List<String> nicknames
    

    Grails doesn’t know that you actually want that mapped (via Hibernate). Grails uses the static hasMany to tell Hibernate how to work without a need for Hibernate mapping files.

    Technically, you don’t need to define the List<String>. You only need the hasMany. This will default in a Set<String>. If you require an indexed list, then keeping List<String> along with the hasMany is fine as well.

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

Sidebar

Related Questions

I'm having trouble using the GWT-Grails plugin. I tried to follow this example exactly,
I am a grails beginner. i have a 2domain class class Employee { String
http://www.grails.org/1.3.1+Release+Notes Improved Query Caching The findAll query method now supports taking advantage of the
I enjoy Git support in Intellij IDEA 8.1.3. I've been doing some Grails Development
I understand that grails 2 now supports singleton scoped controllers. I have a requirement
Here's my grails config for ldap grails.plugins.springsecurity.ldap.context.managerDn = 'uid=admin,ou=system,dc=example,dc=com' grails.plugins.springsecurity.ldap.context.managerPassword = 'secret' grails.plugins.springsecurity.ldap.context.server =
Grails supports content negotiation from 3 different sources: Accept header Request parameter (format) URI
The grails manual shows the following example: <g:set var=now value=${new Date()} scope=request /> and
I'm wondering if grails createCriteria supports group by multiple attributes like pure sql does.
I need to support Basic Auth and Formbased authentication for a application using grails

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.