> Can you give me an example, how i can use ResultSet transformed into
> Map with for example datatable component?
> I think i can write method transforming ResultSet to a Map.
>
> I do not want to use any ORM, because web tier for my app is just
> "control panel" and main features implemented in the backend.
You want to swim without getting wet. Fine :)
public class MyMilkFactory {
public List<Milk> provideHoneyObjects() {
// iterate over sql statement/REsultSet
Milk milk = createMilk(rs);
Honey honey provideHoney(rs.getInteger("honeyid"));
}
public Milk createMilk(ResultSet rs) { // do not use an OR/mapper here
but do the dirty work on your own}
public Honey provideHoney(int id) {//read from database, again do the
dirty work on your own }
}
> 2010/2/15 Ilja Pavkovic <[email protected]>:
> > use any preferred OR mapper like hibernate, toplink, ....
> >
> >> now problem is not accessing object fields..
> >>
> >> problem is transform resultset to these objects..
> >>
> >> 2010/2/12 James Carman <[email protected]>:
> >> > You could create a reference from Honey to Milk, since you have a
> >> > "milkid" field there. Then, you'd use a list of Honey objects and
> >> > you'd display these properties:
> >> >
> >> > id
> >> > milk.id
> >> > name
> >> > milk.name
> >> >
> >> > On Fri, Feb 12, 2010 at 3:58 AM, Ivan Dudko <[email protected]>
wrote:
> >> >> For example..
> >> >> class Honey {
> >> >> int id;
> >> >> int milkid;
> >> >> String name;
> >> >> // getters and setters
> >> >> }
> >> >> class Milk {
> >> >> int id;
> >> >> String name;
> >> >> // getters and setters
> >> >> }
> >> >>
> >> >> and my query:
> >> >> SELECT honey.id ID, honey.milkid MILKID, honey.name HONEYNAME,
> >> >> milk.name MILKNAME FROM honey, milk
> >> >> WHERE honey.milkid=milk.id;
> >> >>
> >> >> And i want to display table with these fields.
> >> >>
> >> >> Which object i must use?
> >> >>
> >> >> 2010/2/11 James Carman <[email protected]>:
> >> >>> Well, what sort of object do you want to display? Are you going to
> >> >>> just create an Object[] for each row in the table? Or, are you
> >> >>> creating a DTO of some sort?
> >> >>>
> >> >>> On Thu, Feb 11, 2010 at 10:50 AM, Ivan Dudko <[email protected]>
> >
> > wrote:
> >> >>>> Thank you.
> >> >>>> I already do simple things with hibernate and spring ioc.
> >> >>>> Now i want to use plain old jdbc.
> >> >>>> I already get the datatable wich works with one pojo (table).
> >> >>>> Now i am in trouble.. how i can get table for two joined tables,
> >> >>>> for example?
> >> >>>>
> >> >>>> 2010/2/11 James Carman <[email protected]>:
> >> >>>>> Yeah, but this doesn't give them an example of how to get the
> >> >>>>> results out of a JDBC result set. This is based on a static,
> >> >>>>> in-memory list of Contact objects. What I would recommend is to
> >> >>>>> look at a Hibernate-based example and come up with the JDBC
> >> >>>>> analog. Here's an example from my Advanced Wicket talk I gave a
> >> >>>>> while back:
> >> >>>>>
> >> >>>>> http://svn.carmanconsulting.com/public/wicket-advanced/trunk/src/m
> >> >>>>> ain
> >> >>>>> /java/com/carmanconsulting/wicket/advanced/web/story3/page/Home.j
> >> >>>>> ava
> >> >>>>>
> >> >>>>> At the bottom, there's a data provider which talks to a
> >> >>>>> "repository" to get its data.
> >> >>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>> On Thu, Feb 11, 2010 at 10:11 AM, Giambalvo, Christian
> >> >>>>>
> >> >>>>> <[email protected]> wrote:
> >> >>>>>> http://cwiki.apache.org/WICKET/simple-sortable-datatable-example.
> >> >>>>>> htm l
> >> >>>>>>
> >> >>>>>> -----Ursprüngliche Nachricht-----
> >> >>>>>> Von: Ivan Dudko [mailto:[email protected]]
> >> >>>>>> Gesendet: Donnerstag, 11. Februar 2010 15:47
> >> >>>>>> An: [email protected]
> >> >>>>>> Betreff: Re: jdbc
> >> >>>>>>
> >> >>>>>> I already have method that return my data from db as arraylist.
> >> >>>>>> And i use this in iterator() method of dataprovider.
> >> >>>>>> But which object (i think model) i must return?
> >> >>>>>>
> >> >>>>>> 2010/2/11 James Carman <[email protected]>:
> >> >>>>>>> You need to create a "provider" for your data. Look at what the
> >> >>>>>>> constructor takes and then implement the interface.
> >> >>>>>>>
> >> >>>>>>> On Thu, Feb 11, 2010 at 8:26 AM, Ivan Dudko
> >> >>>>>>> <[email protected]>
> >
> > wrote:
> >> >>>>>>>> Hello!
> >> >>>>>>>>
> >> >>>>>>>> I can't understand how to populate data from a resultset object
> >> >>>>>>>> into datatable. Anyone have an example?
> >> >>>>>>>>
> >> >>>>>>>> Thank you!
> >> >>>>>>>>
> >> >>>>>>>> ---------------------------------------------------------------
> >> >>>>>>>> --- --- To unsubscribe, e-mail:
> >> >>>>>>>> [email protected] For additional commands,
> >> >>>>>>>> e-mail: [email protected]
> >> >>>>>>>
> >> >>>>>>> ----------------------------------------------------------------
> >> >>>>>>> --- -- To unsubscribe, e-mail:
> >> >>>>>>> [email protected] For additional commands,
> >> >>>>>>> e-mail: [email protected]
> >> >>>>>>
> >> >>>>>> -----------------------------------------------------------------
> >> >>>>>> --- - To unsubscribe, e-mail: [email protected]
> >> >>>>>> For additional commands, e-mail: [email protected]
> >> >>>>>>
> >> >>>>>>
> >> >>>>>> -----------------------------------------------------------------
> >> >>>>>> --- - To unsubscribe, e-mail: [email protected]
> >> >>>>>> For additional commands, e-mail: [email protected]
> >> >>>>>
> >> >>>>> ------------------------------------------------------------------
> >> >>>>> --- To unsubscribe, e-mail: [email protected]
> >> >>>>> For additional commands, e-mail: [email protected]
> >> >>>>
> >> >>>> -------------------------------------------------------------------
> >> >>>> -- To unsubscribe, e-mail: [email protected] For
> >> >>>> additional commands, e-mail: [email protected]
> >> >>>
> >> >>> --------------------------------------------------------------------
> >> >>> - To unsubscribe, e-mail: [email protected] For
> >> >>> additional commands, e-mail: [email protected]
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: [email protected]
> >> >> For additional commands, e-mail: [email protected]
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: [email protected]
> >> > For additional commands, e-mail: [email protected]
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >
> > --
> > binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin
> >
> > +49 · 171 · 9342 465
> >
> > Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
> > Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost Becker
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
--
binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin
+49 · 171 · 9342 465
Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost Becker
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]