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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:34:01+00:00 2026-05-22T17:34:01+00:00

I inherited a Grails project that has both Hibernate .xml files AND Domain classes

  • 0

I inherited a Grails project that has both Hibernate .xml files AND Domain classes for the Model. This thread leads me to believe that that is not correct. I am upgrading the project from 1.0.3 to 1.3.7. The way I understand it, it worked in 1.0.3 but is no longer supported after 1.2.

The Hibernate XML files provide all of the mappings to the objects, but the same objects in the Domain have properties and methods that extend the objects, so both make sense to keep.

  • Is there any way I can still have the best of both worlds (keeping the
    Hibernate Mapping as well as the
    Domain objects)?

  • If not, What is the recommended way to proceed?

UPDATE:

I want to be able to have a Hibernate XML file Book.hbm.xml as well as a file /src/groovy/Book.groovy that has extra methods on the class.

From the documentation it looks like they are treated as two separate things:

Q: How can I access domain classes
from sources in src/groovy?

Sometimes, you are developing some
utility classes that live in
src/groovy and which you intend to use
from Services and other artifacts.
However, as those classes are
pre-compiled by Grails, it is not
possible to instantiate them and write
things like Book.findByTitle("Groovy
in Action"). But fortunately, there is
a workaround since it’s possible to do
this:

import
org.codehaus.groovy.grails.commons.ApplicationHolder
//… def book =
ApplicationHolder.application.getClassForName("library.Book").findByTitle("Groovy
in Action"

Doesn’t it seem like this would be a normal thing to do if someone wanted to use Hibernate XML?

  • 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-22T17:34:02+00:00Added an answer on May 22, 2026 at 5:34 pm

    You need the class definition files in src/java and the hibernate mapping files in grails-app/conf/hibernate as explained in Grails 1.0.3 Upgrade Problems.

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

Sidebar

Related Questions

I inherited a project that includes the following crazy JavaScript. I assume this is
I inherited a Basic MSI InstallShield ISM to install an application that has a
I inherited an MFC app, and it has a window that has several owner-draw
i have a java class used as an entity that has 2 classes that
I inherited a project that uses SQL Server 200x, wherein a column that stores
I'd like to version a grails domain class by DateTime such that: each primary
I inherited a project that uses CoreData for a certain type of data storage.
I inherited MYSQL database that has lots of tables with data like CREATE TABLE
I inherited a project from a colleague that left the company. While examining his
We inherited some leagcy code that has a whole lot of code copy/pasted across

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.