commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sameer Nanda <sam5...@gmail.com>
Subject Re: [betwixt] Problem loading a Bean in Betwixt
Date Mon, 17 Oct 2005 19:51:29 GMT
Hey Tom, Konstantin (Guys)

I got it working ..... What a stupid thing that was !!!! I have a hibernate
mapping file which maps my Bean to the DB table, and I was looking at what
Konstantin was saying about Lazy proxies


> Just looked into dependencies - Yep. cgilib with asm
> backend...

> Ok, then a mapping that blends these part out,
> should suffice.

> Not necessarily... If there are collections, they
> are also lazy proxies and look into session...


So there it is, I have an attribute called "lazy" in my HIbernate mapping
file which I never used. So I just tried setting it to "false" and BOOM !!!
now it works. Thats made my life so easy, after I saw that small peice of
XML code which Betwixt had generated

<perspectiveResponse>
<object>
<personId>5667</personId>
<firstName>Kelly</firstName>
<lastName>Witham</lastName>
<type>Customer</type>
</object>
</perspectiveResponse>

Wow I never imagines this small peice of XMl code would make me so happy !!!
that looks so awesome. Well thank you guys, for been with me all day long. I
really appreciate.

I thank you individually Tom and Konstantin.

Tom, I also tried without the mapping file, it doesn really need one now.
Thank you for your idea though. But I do have a question for you , now since
this seems to be "Working" as per my wish, could you provide me (if you have
some) live examples on Derived Beans, because what I am eventually trying to
do is get the output from PerpectiveResponse Bean depending upon the type of
Object passed to it.

For now I was passing the Person object so I got the XML for Person, but if
I wanted to pass some other object I would want to see the XML for that
Object, which in terms of Betwixt is (I suppose) called as Derived Beans
!!!!

Would you put some of your thoughts on how can I achieve this in a Betwixt
standard way ...

Regards,
Sameer

On 10/17/05, Sameer Nanda <sam504u@gmail.com> wrote:
>
> I tried Tom ...
>
> But its the same error again, could you plz check what I did was what you
> asked me to.
>
> Now, I have a mapping.xml file in my local directory which looks like
> this:
>
> <?xml version="1.0"?>
> <betwixt-config>
> <!--name of the class to map -->
> <class name="com.mms.Person">
> <!-- standard definations (same as in standard .betwixt file) -->
> <element name="Person">
> <element name="personId" property="personId"/>
> <element name="firstName" property="firstName"/>
> <element name="lastName" property="lastName"/>
> <element name="type" property="type"/>
> </element>
> </class>
> </betwixt-config>
>
> where Person is the bean which I want to output as XML format, with all
> these elements within it (as shown in mapping.xml)
>
> and then in my Main class I read the mapping file:
>
>
> beanWriter.getXMLIntrospector().register(new
> InputSource("src/com/mms/mapping.xml"));
> Person person = (Person) session.load(Person.class,5667);
>
> beanWriter.write("perspectiveResponse", new PerspectiveResponse(person));
> System.out.println(outputWriter.toString());
>
>
> But still getting the same errorstack:
> java.lang.UnsupportedOperationException
> at org.hibernate.util.IdentityMap.keySet(IdentityMap.java:162)
> at org.hibernate.stat.SessionStatisticsImpl.getEntityCount(
> SessionStatisticsImpl.java:21)
> at org.hibernate.stat.SessionStatisticsImpl.toString(
> SessionStatisticsImpl.java:37)
> at java.lang.String.valueOf(String.java:2577)
> at java.lang.StringBuffer.append(StringBuffer.java:220)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.pushBean(
> AbstractBeanWriter.java:1019)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(
> AbstractBeanWriter.java:348)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(
> AbstractBeanWriter.java:267)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeElementContent(
> AbstractBeanWriter.java:945)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeElement(
> AbstractBeanWriter.java:820)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(
> AbstractBeanWriter.java:362)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(
> AbstractBeanWriter.java:267)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeElementContent(
> AbstractBeanWriter.java:945)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeElement(
> AbstractBeanWriter.java:820)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(
> AbstractBeanWriter.java:362)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(
> AbstractBeanWriter.java:267)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeElementContent(
> AbstractBeanWriter.java:936)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeElement(
> AbstractBeanWriter.java:820)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(
> AbstractBeanWriter.java:362)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(
> AbstractBeanWriter.java:267)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeElementContent(
> AbstractBeanWriter.java:945)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeElement(
> AbstractBeanWriter.java:820)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(
> AbstractBeanWriter.java:362)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(
> AbstractBeanWriter.java:243)
> at org.apache.commons.betwixt.io.AbstractBeanWriter.write(
> AbstractBeanWriter.java:174)
> at com.mms.HibernateTest.main(HibernateTest.java:52)
>
> Was I doing what you said??? And whats the solution to get out of this
> problem.
>
> -Sameer
> On 10/17/05, Thomas Dudziak <tomdzk@gmail.com> wrote:
> >
> > IMHO means "in my humble opinon", just like IMO means "in my opinon".
> > ITE is probably ( ;-) ) InvocationTargetException
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message