You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Gensky Regnus <re...@techolap.com> on 2000/07/11 22:03:37 UTC
Re: xsp-castor taglib
Donald Ball wrote:
>
> On Tue, 11 Jul 2000, Gensky Regnus wrote:
>
> > I am having problems with boolean variables when using xsp-castor. I
> > think it's related to the way the sql type is handled in
> > XSPCastorLibrary, in the char[01] conversion from char SQL type to
> > Boolean Java type. I was successful in deleting/storing/retrieving and
> > marshaling the same objects from the command line.
>
> holy canoli, someone's _using_ xsp-castor (besides kevin and
> i)? hurrah! can you give me some more details on your database and its
> schema?
I added the following in the Author class
private boolean active;
public void setActive(boolean newActive) {
active = newActive;
}
public boolean isActive() {
return active;
}
added active char(1) to the author_table and inserted
<field name="active" type="boolean" get-method="isActive"
set-method="setActive" required="true">
<sql name="active" type="char[01]"/>
<xml node="element"/>
</field>
inside the Author class mapping in the mapping.xml file
The form shows up with the given name, family name and a select box for
active, but when I try to save a new Author, I get
Error: 500
Location: /wz-castor/servlet/AdminServlet
Internal Servlet Error:
javax.servlet.ServletException: java.lang.IllegalArgumentException: The
wrong convertor was used to convert value of type java.lang.Boolean
at
com.webslingerZ.castor.AdminServlet.service(AdminServlet.java, Compiled
Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
Compiled Code)
This setup worked before adding the boolean field.
> > I am also looking for advice on how to do the SAX to DOM thing. The
> > interface provided by Castor (Marshaller) is SAX based while XSP seems
> > to expect DOM elements being returned.
>
> Er, can't see what you're looking for here.
My question was, how do I retrieve a java object, say Author, as a DOM
element so it can be further processed by Cocoon. Should I use the
Castor Marshaller instead?
Thanks
--
Gensky
Re: xsp-castor taglib
Posted by Donald Ball <ba...@webslingerZ.com>.
On Tue, 11 Jul 2000, Gensky Regnus wrote:
> Donald Ball wrote:
> >
> > On Tue, 11 Jul 2000, Gensky Regnus wrote:
> >
> > > I am having problems with boolean variables when using xsp-castor. I
> > > think it's related to the way the sql type is handled in
> > > XSPCastorLibrary, in the char[01] conversion from char SQL type to
> > > Boolean Java type. I was successful in deleting/storing/retrieving and
> > > marshaling the same objects from the command line.
> >
> > holy canoli, someone's _using_ xsp-castor (besides kevin and
> > i)? hurrah! can you give me some more details on your database and its
> > schema?
>
> I added the following in the Author class
>
> private boolean active;
>
> public void setActive(boolean newActive) {
> active = newActive;
> }
>
> public boolean isActive() {
> return active;
> }
>
> added active char(1) to the author_table and inserted
>
> <field name="active" type="boolean" get-method="isActive"
> set-method="setActive" required="true">
> <sql name="active" type="char[01]"/>
> <xml node="element"/>
> </field>
>
> inside the Author class mapping in the mapping.xml file
>
> The form shows up with the given name, family name and a select box for
> active, but when I try to save a new Author, I get
right, the library things that all character arrays should be strings, and
it's failing when trying to convert one to a boolean. makes sense in my
opinion, but you might write to the castor dev list and plead your
case. myself, i use bits or tinyints to store boolean values depending on
the database (some databases provide bit columns but won't let you call
rs.getBoolean on them!!?!)
> > > I am also looking for advice on how to do the SAX to DOM thing. The
> > > interface provided by Castor (Marshaller) is SAX based while XSP seems
> > > to expect DOM elements being returned.
> >
> > Er, can't see what you're looking for here.
>
> My question was, how do I retrieve a java object, say Author, as a DOM
> element so it can be further processed by Cocoon. Should I use the
> Castor Marshaller instead?
If you're talking about simply rendering the object, not editing it, that
falls outside the scope of the wz-castor library. i can imagine a castor
object display logicsheet, similar to the sql logicsheet but working with
JDO objects instead. you could also fall back on straight sql. currently
i'm waiting on many-to-many support (and lazy loading) to be added to
castor before i can really begin actively using it. i plan on working on a
castor object display logicsheet once that's in place, but it may be a
little while. it shouldn't be a hard job, anyway, just provide a wrapper
for castor's marshaller.
- donald