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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:47:37+00:00 2026-05-17T23:47:37+00:00

I have a Role domain class, which I have simplified to illustrate the case

  • 0

I have a Role domain class, which I have simplified to illustrate the case here:

@XmlRootElement(name="Role")
@XmlAccessorType(XmlAccessType.NONE) 
public class Role implements Comparable
{
    @XmlElement
    String title = ""
}

I have some code to test marshalling this domain class which is :

try {
        employee.getProjects().each{ proj -> 
            println "Project name :" + proj.name
            proj.getRoles().each{

                println ("Role title:" + it.title)
                context = JAXBContext.newInstance(Role.class);
                Marshaller m = context.createMarshaller();
                m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
                m.marshal ((Role)it, System.out)

            }
        }

    }catch (JAXBException e){
        e.printStackTrace();
        println(e.getCause())
        println ("Ever getting here?")
    }

As you can see, i have some other classes where this is coming from, Employee hasmany projects, Project hasmany Roles

when I run this method, I am getting the following:

Project name :Project 1
Role title:Software Engineer1
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Role>
    <title></title>
</Role>
Project name :Project 2
Role title:Software Engineer2
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Role>
    <title></title>
</Role>
Project name :Project 3
Role title:Software Engineer3
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Role>
    <title>Software Engineer3</title>
</Role>

What is going on here? This is driving me nuts that it clearly knows to be marshalling title, and the values are there – I can PRINT them but yet they arent showing up wthi avlues in the XML

  • 1 1 Answer
  • 3 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-17T23:47:37+00:00Added an answer on May 17, 2026 at 11:47 pm

    It would appear this is a hibernate lazy loading problem. I am trying to figure out how to turn off lazy loading for my whole project in the hibernate grails configuration. Barring that, it appears I should be able to workaround the problem using explicit getters/setters, but that is not very groovy.

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

Sidebar

Related Questions

I have following mapping definitions: <class name=Role table=Role optimistic-lock=version > <id name=Id type=Int32 unsaved-value=0
I have a web role configured with SSL, which has a ReportViewer control that
I have three classes (domain, role and user). Domain and role are properties of
I have a class like this : class User { String name; String password;
I have a domain three domain class like this : Tasks.groovy class Tasks {
I have domain classes as: package mnm.schedule class Project { static hasMany = [
I have the following domains: User, Role, Company. User and Role has m:n relationship,
I have a Web Role that is using the ASP.NET SQL Membership provider. Currently
We have a Web Role that we are hosting in Windows Azure that uses
Is there a way to see users that have certain security role assigned? I'm

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.