Re: Re: Re: jdbc

2010-02-16 Thread Ivan Dudko
Thank you all guys!

I just do it with Map.

Especially thanks to Leo.Erlandsson!

2010/2/15  :
> Should be no different when using JDBC than using it when using Domain
> Objects.
>
> Check out Wicket Phonebook Example that uses FilterToolbar:
> http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-phonebook
>
> Source Code Example:
> https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/phonebook/src/main/java/wicket/contrib/phonebook/web/page/ListContactsPage.java
>
>
>> Thank you!
>> I just discovered this sample:
>> http://www.brettdutton.com/blog/?p=4
>
>> What i can do.. if i want to use FilterToolbar with DataTable?
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Re: Re: jdbc

2010-02-15 Thread Leo . Erlandsson
Should be no different when using JDBC than using it when using Domain 
Objects.

Check out Wicket Phonebook Example that uses FilterToolbar:
http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-phonebook

Source Code Example:
https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/phonebook/src/main/java/wicket/contrib/phonebook/web/page/ListContactsPage.java


> Thank you!
> I just discovered this sample:
> http://www.brettdutton.com/blog/?p=4

> What i can do.. if i want to use FilterToolbar with DataTable?


Re: Re: jdbc

2010-02-15 Thread Ivan Dudko
Thank you!
I just discovered this sample:
http://www.brettdutton.com/blog/?p=4

What i can do.. if i want to use FilterToolbar with DataTable?

2010/2/15  :
> If you want to use a Map and display it in a Datatable there's no
> difference from using an Object in Wicket.
>
> You access the key/values using PropertyColumn as usual (i.e. you don't
> really need to make any changes to your code). For Objects you use e. g.
> "name" for the getName() method. When using Maps "name" will return the
> value corresponding to the key "name".
>
>
>
>
>> 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 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 }
>>}
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Re: jdbc

2010-02-15 Thread Leo . Erlandsson
If you want to use a Map and display it in a Datatable there's no 
difference from using an Object in Wicket. 

You access the key/values using PropertyColumn as usual (i.e. you don't 
really need to make any changes to your code). For Objects you use e. g. 
"name" for the getName() method. When using Maps "name" will return the 
value corresponding to the key "name".




> 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 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 }
>}


Re: Re: jdbc

2010-02-15 Thread Leo . Erlandsson
>now problem is not accessing object fields..

>problem is transform resultset to these objects..

You could just work with Maps in Wicket instead of Domain Objects. The 
transformation from ResultSet to a Map containing the Column name as Key 
and the data as Value should be trivial (if not; reply and I'll provide 
sample code) using MetaData (this is how we do it in our JSP pages today).

Or you could write / find a software that does the mapping from JDBC 
ResultSet to Domain Objects... But why not use an ORM such as Hibernate / 
Cayenne / iBatis then.. ?