Quantcast

XML converter adding _$$_javassist_15 postfix to node names

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

XML converter adding _$$_javassist_15 postfix to node names

Krystian
Hi,

I'm getting strange [to me] _$$_javassist_15 postfix added to node names in my xml.

What I do is:
I have a criteria search and I convert the output to XML and render it.
Unfortunately I get this postfixes which break a lot of functionality.

How can I get rid of it?

Just to make it more clear, I have three domains:

DomainA {
 hasMany domainsB:DomainB
 int something
}

DomainB {
 DomainA domainA
 hasMany domainsC:DomainC
 int somethingElse
}

DomainC{
  DomainB domainB

}


My criteria query looks like this:


    def criteria = DomainA.createCriteria()
    def results = criteria {
        eq("something", 15)
        domainsB {
          le("somethingElse", 16)
        }      
      }


And I get XML like:


<?xml version="1.0" encoding="UTF-8"?>
      <unitDefinition id="1">
        <somethingA>
          15
        </somethingA>
        <domainsB>
          <domainB id="1">
            <somethingElse>
              16
            </somethingElse>
            <domainsC>
              <domainC_$$_javassist_15 id="1">
                <name>
                  something
                </name>
              </domainC$$_javassist_15>
            </domainsC>
          </domainB>
        </domainsB>
      </domainA>
   

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: XML converter adding _$$_javassist_15 postfix to node names

johnrellis
I think This is because Grails loads a proxy for domains inside domains.  You should probably eagerly fetch them :


Scroll to bottom.

Of course you could just substring your Class names but that would mean more DB queries.

John

On Fri, Sep 10, 2010 at 1:59 PM, Krystian <[hidden email]> wrote:

Hi,

I'm getting strange [to me] _$$_javassist_15 postfix added to node names in
my xml.

What I do is:
I have a criteria search and I convert the output to XML and render it.
Unfortunately I get this postfixes which break a lot of functionality.

How can I get rid of it?

Just to make it more clear, I have three domains:

DomainA {
 hasMany domainsB:DomainB
 int something
}

DomainB {
 DomainA domainA
 hasMany domainsC:DomainC
 int somethingElse
}

DomainC{
 DomainB domainB

}


My criteria query looks like this:


   def criteria = DomainA.createCriteria()
   def results = criteria {
       eq("something", 15)
       domainsB {
         le("somethingElse", 16)
       }
     }


And I get XML like:


<?xml version="1.0" encoding="UTF-8"?>
     <unitDefinition id="1">
       <somethingA>
         15
       </somethingA>
       <domainsB>
         <domainB id="1">
           <somethingElse>
             16
           </somethingElse>
           <domainsC>
             <domainC_$$_javassist_15 id="1">
               <name>
                 something
               </name>
             </domainC$$_javassist_15>
           </domainsC>
         </domainB>
       </domainsB>
     </domainA>



--
View this message in context: http://grails.1312388.n4.nabble.com/XML-converter-adding-javassist-15-postfix-to-node-names-tp2534392p2534392.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
John Rellis
@johnrellis

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: XML converter adding _$$_javassist_15 postfix to node names

Krystian
Hi John,

tanks for the answer.
Unfortunately changing fetch mode has no effect on the output of the xml.

I've tried changing fetchModes for domainsB and domainsC and it had no effect.

Any other thoughts?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: XML converter adding _$$_javassist_15 postfix to node names

Krystian
Hi again,

I've tried different methods to set the fetchMode to eager and it gave me nothing. I still have that javassist thing in node name.

I would really appreciate help with this :(
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: XML converter adding _$$_javassist_15 postfix to node names

Krystian
sorry for mass mailing but I made a mistake in previous mail

When I change the domainB definition to include:

static mapping = {
    domainsC  lazy:'false'
  }

my criteria will not return proxies.
But this is only one criteria search I want to have domainsC eagerly fetched, in the rest of the application I want them fetched lazily.

This is why I'm looking for a way to have them eagerly fetched for this one query only.

Thanks,
Krystian
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: XML converter adding _$$_javassist_15 postfix to node names

johnrellis
Could you post the code you are using to convert to xml or are you just doing myDomains as XML???

On Mon, Sep 13, 2010 at 12:44 PM, Krystian <[hidden email]> wrote:

sorry for mass mailing but I made a mistake in previous mail

When I change the domainB definition to include:

static mapping = {
   domainsC  lazy:'false'
 }

my criteria will not return proxies.
But this is only one criteria search I want to have domainsC eagerly
fetched, in the rest of the application I want them fetched lazily.

This is why I'm looking for a way to have them eagerly fetched for this one
query only.

Thanks,
Krystian
--
View this message in context: http://grails.1312388.n4.nabble.com/XML-converter-adding-javassist-15-postfix-to-node-names-tp2534392p2537279.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
John Rellis
@johnrellis

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: XML converter adding _$$_javassist_15 postfix to node names

Krystian
XML.use("deep") { render results as XML }

I went one step further with my research and it seems the problem lies within query caching. When query caching is disabled for this specific query [ useCaching(false) ] it works just as expected and I don't get proxies in the results.

Another thing is Grails omits fetchMode set in a different than top level of the query.

This will not work:
 def criteria = DomainA.createCriteria()
   def results = criteria {
       eq("something", 15)
       domainsB {
         fetchMode("domainsC", FetchMode.JOIN)
         le("somethingElse", 16)
       }
     }

This will:

 def criteria = DomainA.createCriteria()
   def results = criteria {
       eq("something", 15)
       fetchMode("domainsB.domainsC", FetchMode.JOIN)
       domainsB {
         le("somethingElse", 16)
       }
     }



I will post 2 bugs on jira and see where it goes.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: XML converter adding _$$_javassist_15 postfix to node names

johnrellis
awesome work on tracking down the issue, maybe reply to the links of the Jira issues so people with the same issue can track the progress?

On Mon, Sep 13, 2010 at 1:54 PM, Krystian <[hidden email]> wrote:

XML.use("deep") { render results as XML }

I went one step further with my research and it seems the problem lies
within query caching. When query caching is disabled for this specific query
[ useCaching(false) ] it works just as expected and I don't get proxies in
the results.

Another thing is Grails omits fetchMode set in a different than top level of
the query.

This will not work:
 def criteria = DomainA.createCriteria()
  def results = criteria {
      eq("something", 15)
      domainsB {
        fetchMode("domainsC", FetchMode.JOIN)
        le("somethingElse", 16)
      }
    }

This will:

 def criteria = DomainA.createCriteria()
  def results = criteria {
      eq("something", 15)
      fetchMode("domainsB.domainsC", FetchMode.JOIN)
      domainsB {
        le("somethingElse", 16)
      }
    }



I will post 2 bugs on jira and see where it goes.
--
View this message in context: http://grails.1312388.n4.nabble.com/XML-converter-adding-javassist-15-postfix-to-node-names-tp2534392p2537373.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
John Rellis
@johnrellis

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: XML converter adding _$$_javassist_15 postfix to node names

Krystian
Hi again

Here's the caching issue:
http://jira.codehaus.org/browse/GRAILS-6721

I cannot reproduce the issue with fetchMode in my example app.
I can see it on my dev environment, now trying to find differences.

Krystian
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: XML converter adding _$$_javassist_15 postfix to node names

Krystian
I have finally managed to figure out how the fetchMode works in CriteriaBuilder, here's the jira issue with all the information I got during investigation, hope it's more or less clear.

http://jira.codehaus.org/browse/GRAILS-6724

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: XML converter adding _$$_javassist_15 postfix to node names

ross.oreto
I'm having this exact same issue, and even after using eager fetching. I'm using Grails 2.1.0

    static hasMany = [ roles: RicRole, permissions: String ]
    static mapping = {
                roles lazy: false;
    }

And I get back _$$_javassist_1 added to each role in XML converter.
Loading...