ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carfield Yim" <carfi...@gmail.com>
Subject Re: Can ibatis work with java object with constructor have parameters?
Date Tue, 09 Jan 2007 03:36:49 GMT
That is kind of surprise me, I thought this is a common use case to
implement role permission. However look like this is not the case.

In fact I just do it this way in my last application as we write DAO
ourselves without any tools. May be you can share how ibatis user
commonly do for role permission?

On 1/9/07, Clinton Begin <clinton.begin@gmail.com> wrote:
>
> ACK!!! Sorry, my bad.  It wasn't RowHandler.  It was the custom
> TypeHandlerCallback.  ResultGetter now exposes the ResultSet.
>
> Sorry for the confusion and my unclear brain before my Starbucks Grande
> Half-Sweet Vanilla Americano with room.
>
> Cheers,
> Clinton
>
> On 1/8/07, Larry Meadors <lmeadors@apache.org> wrote:
> > Hmm, RowHandler is clear of java.sql references - as it should be.
> >
> > There are some ResultSet references passed around in the type handler
> > extension points..
> >
> > Larry
> >
> >
> > On 1/8/07, Clinton Begin < clinton.begin@gmail.com> wrote:
> > > Except for that new method Larry added to the RowHandler APIs...you can
> now
> > > get the original ResultSet while the rows are being returned from within
> a
> > > RowHandler.
> > >
> > > But other than that very isolated case, Brandon is right, you can't just
> > > arbitrarily get the ResultSet and do with it as you please.
> > >
> > > Cheers,
> > > Clinton
> > >
> > >
> > > On 1/8/07, Brandon Goodin <brandon.goodin@gmail.com> wrote:
> > > > No you cannot get a ResultSet. iBATIS will not at anytime from
> anywhere
> > > provide you a reference to the ResultSet.
> > > >
> > > > Brandon
> > > >
> > > >
> > > >
> > > > On 1/8/07, Carfield Yim <carfield@gmail.com> wrote:
> > > > > Just really read
> > > > >
> > >
> http://ibatis.apache.org/docs/java/dev/com/ibatis/sqlmap/client/event/RowHandler.html
> > > > > , However can I get the resultset from the RowHandler?
> > > > >
> > > > > On 1/8/07, Brandon Goodin <brandon.goodin@gmail.com> wrote:
> > > > > > Sounds like you can use a RowHandler for this.
> > > > > >
> > > > > >
> > > > > > Brandon
> > > > > >
> > > > > > On 1/7/07, Carfield Yim < carfield@gmail.com> wrote:
> > > > > > > Actually I get I cannot do... but anyway, just ask.
> > > > > > >
> > > > > > > For method
> > > > > >
> > >
> http://ibatis.apache.org/docs/java/dev/com/ibatis/sqlmap/engine/mapping/result/ResultObjectFactory.html#createInstance(java.lang.String,
> > > > > > > java.lang.Class)
> > > > > > >
> > > > > > > instead of having
> > > > > > > public Object ResultObjectFactory(String id, Class clazz)
{
> > > > > > >     Constructor con = clazz.getDeclaredConstructor(new
> > > > > > Class[]{String.class});
> > > > > > >     return con.newInstance(objectStaticAvailable);
> > > > > > > }
> > > > > > >
> > > > > > > Can I init the object using resultset result, like
> > > > > > >
> > > > > > > public Object ResultObjectFactory(String id, ResultSet
rs, Class
> > > clazz) {
> > > > > > >     Constructor con = clazz.getDeclaredConstructor(new
> > > > > > Class[]{ String.class});
> > > > > > >     return con.newInstance(rs.getString("id"));
> > > > > > > }
> > > > > > >
> > > > > > > So that I can use the ID of the record to check for permission
> when
> > > > > > > initalization. If the user don't have permission to load
that
> > > record,
> > > > > > > the system will throw an exception and we will show an
generic
> > > > > > > permission deny page.
> > > > > > >
> > > > > > > On 1/8/07, Brandon Goodin < brandon.goodin@gmail.com
> wrote:
> > > > > > > > I'm not completely sure what you are asking. But,
if you are
> > > asking if
> > > > > > you
> > > > > > > > can get the ResultSet itself that would be a no. iBATIS
is
> JDBC
> > > wrapper.
> > > > > > If
> > > > > > > > you find that you need more direct access to JDBC
then you
> should
> > > use
> > > > > > JDBC
> > > > > > > > directly.
> > > > > > > >
> > > > > > > >
> > > > > > > > Brandon
> > > > > > > >
> > > > > > > > On 1/7/07, Carfield Yim < carfield@gmail.com>
wrote:
> > > > > > > > > Can I get the reference of resultset when the
object is
> > > initalizating?
> > > > > > > > >
> > > > > > > > > On 1/8/07, Brandon Goodin < brandon.goodin@gmail.com>
wrote:
> > > > > > > > > > You can find the javadoc here:
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > >
> http://ibatis.apache.org/docs/java/dev/com/ibatis/sqlmap/engine/mapping/result/ResultObjectFactory.html
> > > > > > > > > >
> > > > > > > > > > I was assuming you were wanting to map result
values to a
> > > > > > constructor.
> > > > > > > > If
> > > > > > > > > > you are trying to map results to a constructor,
it would
> seem
> > > a
> > > > > > tedious
> > > > > > > > > > effort to use the ResultObjectFactory for
this.
> > > > > > > > > >
> > > > > > > > > > I know it is lame that we don't have this
functionality.
> But,
> > > we've
> > > > > > > > > > discussed adding the constructor mapping
functionality and
> > > have
> > > > > > decided
> > > > > > > > it
> > > > > > > > > > is best to delay adding it until iB3 (no
eta).
> > > > > > > > > >
> > > > > > > > > > Brandon
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On 1/7/07, Carfield Yim < carfield@gmail.com>
wrote:
> > > > > > > > > > > I just check for the document and I
cannot see those
> APIs ,
> > > > > > > > > > >
> http://ibatis.apache.org/docs/java/user/ ,
> > > am I
> > > > > > > > looking
> > > > > > > > > > for wrong
> > > > > > > > > > > thing?
> > > > > > > > > > >
> > > > > > > > > > > On 1/8/07, Goga, Murtaza < murtaza.goga@trisyngroup.com>
> > > wrote:
> > > > > > > > > > > > Have you considered using an implementation
of
> > > > > > ResultObjectFactory?
> > > > > > > > It
> > > > > > > > > > can be configured within iBatis or injected
into the
> > > > > > > > SqlMapExecutorDelegate.
> > > > > > > > > >  Either ways you will have control over
the creation and
> > > subsequent
> > > > > > > > > > initialization of objects.
> > > > > > > > > > > >
> > > > > > > > > > > > ________________________________
> > > > > > > > > > > >
> > > > > > > > > > > > From: Peng Wang [mailto: wpcfan@gmail.com
]
> > > > > > > > > > > > Sent: Sun 1/7/2007 9:26 PM
> > > > > > > > > > > > To: user-java@ibatis.apache.org
> > > > > > > > > > > > Subject: Re: Can ibatis work with
java object with
> > > constructor
> > > > > > have
> > > > > > > > > > parameters?
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > You can do this using Spring.
I think iBatis does not
> have
> > > to
> > > > > > > > support
> > > > > > > > > > this.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > On 1/8/07, Carfield Yim < carfield@gmail.com
> wrote:
> > > > > > > > > > > >
> > > > > > > > > > > >         To bad to hear that, is
it planned to be
> > > implemented?
> > > > > > > > > > > >
> > > > > > > > > > > >         On 1/8/07, Brandon Goodin
<
> > > brandon.goodin@gmail.com >
> > > > > > wrote:
> > > > > > > > > > > >         > This is not currently
implemented.
> > > > > > > > > > > >         >
> > > > > > > > > > > >         > Brandon
> > > > > > > > > > > >         >
> > > > > > > > > > > >         >
> > > > > > > > > > > >         > On 1/6/07, Carfield
Yim < carfield@gmail.com
> > > > > > > > > > <mailto: carfield@gmail.com> >
wrote:
> > > > > > > > > > > >         > > I like to pass
something to the object
> while
> > > > > > > > initalization,
> > > > > > > > > > can I
> > > > > > > > > > > >         > > specific about
that?
> > > > > > > > > > > >         > >
> > > > > > > > > > > >         >
> > > > > > > > > > > >         >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
>

Mime
View raw message