Re: data persistence using hibernate

2023-01-25 Thread Vit Rozkovec
ro wrote:

https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/model/Customer.java
This defines a JPA entity and this JPA/Hibernate


https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/resources/application.yml
Project uses Spring magic I guess and will start a Hibernate with H2.
Wicket is also started via SpringBoot.


On Tue, Dec 20, 2022 at 7:44 AM James 
wrote:
I've had a look through it but couldn't find any reference to
hibernate
so far, its entirely
possible that I managed to miss it while I was searching though

Best Regards
James Pollard
james.poll...@iinet.net.au

On 19/12/22 5:06 pm, Ernesto Reinaldo Barreiro wrote:
Hi,

This project

https://github.com/MarcGiffing/wicket-spring-boot

contains a sample project that integrates with JPA/hibernate.


On Mon, Dec 19, 2022 at 9:12 AM James 
wrote:
Hi,
can anyone direct me to any resources on how to integrate
hibernate
for
data persistence?

the closest I've managed to find is


https://www.infoworld.com/article/2077901/web-development-with-wicket--part-3--many-ways-to-persist.html?page=7
but there's still things that are confusing me on how to
ingrate an
authenticated application with hibernate

--
Best Regards
James Pollard
james.poll...@iinet.net.au



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


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


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


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


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


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




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

[EXTERNAL EMAIL] CAUTION: This email originated from outside of Telenav. DO NOT 
CLICK links or attachments unless you recognize the sender and know the content 
is safe.





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



Re: data persistence using hibernate

2023-01-24 Thread Locke, Jonathan (Luo Shibo)
rter-example/src/main/java/com/giffing/wicket/spring/boot/example/model/Customer.java
This defines a JPA entity and this JPA/Hibernate


https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/resources/application.yml
Project uses Spring magic I guess and will start a Hibernate with H2.
Wicket is also started via SpringBoot.


On Tue, Dec 20, 2022 at 7:44 AM James 
wrote:
I've had a look through it but couldn't find any reference to
hibernate
so far, its entirely
possible that I managed to miss it while I was searching though

Best Regards
James Pollard
james.poll...@iinet.net.au

On 19/12/22 5:06 pm, Ernesto Reinaldo Barreiro wrote:
Hi,

This project

https://github.com/MarcGiffing/wicket-spring-boot

contains a sample project that integrates with JPA/hibernate.


On Mon, Dec 19, 2022 at 9:12 AM James 
wrote:
Hi,
can anyone direct me to any resources on how to integrate
hibernate
for
data persistence?

the closest I've managed to find is


https://www.infoworld.com/article/2077901/web-development-with-wicket--part-3--many-ways-to-persist.html?page=7
but there's still things that are confusing me on how to
ingrate an
authenticated application with hibernate

--
Best Regards
James Pollard
james.poll...@iinet.net.au



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


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


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


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


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


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




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

[EXTERNAL EMAIL] CAUTION: This email originated from outside of Telenav. DO NOT 
CLICK links or attachments unless you recognize the sender and know the content 
is safe.



Re: data persistence using hibernate

2023-01-24 Thread James Pollard
JPA entity and this JPA/Hibernate



https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/resources/application.yml

Project uses Spring magic I guess and will start a Hibernate with H2.
Wicket is also started via SpringBoot.


On Tue, Dec 20, 2022 at 7:44 AM James 

wrote:

I've had a look through it but couldn't find any reference to
hibernate
so far, its entirely
possible that I managed to miss it while I was searching though

Best Regards
James Pollard
james.poll...@iinet.net.au

On 19/12/22 5:06 pm, Ernesto Reinaldo Barreiro wrote:

Hi,

This project

https://github.com/MarcGiffing/wicket-spring-boot

contains a sample project that integrates with JPA/hibernate.


On Mon, Dec 19, 2022 at 9:12 AM James 

wrote:

Hi,
can anyone direct me to any resources on how to integrate
hibernate

for

data persistence?

the closest I've managed to find is



https://www.infoworld.com/article/2077901/web-development-with-wicket--part-3--many-ways-to-persist.html?page=7

but there's still things that are confusing me on how to
ingrate an
authenticated application with hibernate

--
Best Regards
James Pollard
james.poll...@iinet.net.au




-

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



-

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



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




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



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



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





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



Re: data persistence using hibernate

2023-01-23 Thread Martin Grigorov
ank you for accommodating all my questions and misunderstandings so
> >>>> far, I tend to use a reverse
> >>>> engineer learning style so it's helped me immensely.
> >>>>
> >>>> Glad to be of some help. This is why this place is for.
> >>>
> >>>> I've included screenshots of the project file list and the application
> >>>> class in the hopes that it makes
> >>>>
> >>> They didn't
> >>>
> >>>
> >>>> understanding what I'm trying to convey easier
> >>>>
> >>>> Best Regards
> >>>> James Pollard
> >>>> james.poll...@iinet.net.au
> >>>>
> >>>> On 20/12/22 12:58 pm, Ernesto Reinaldo Barreiro wrote:
> >>>>
> https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/model/Customer.java
> >>>>
> >>>>> This defines a JPA entity and this JPA/Hibernate
> >>>>>
> >>>>>
> >>>>
> https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/resources/application.yml
> >>>>
> >>>>> Project uses Spring magic I guess and will start a Hibernate with H2.
> >>>>> Wicket is also started via SpringBoot.
> >>>>>
> >>>>>
> >>>>> On Tue, Dec 20, 2022 at 7:44 AM James 
> >>>> wrote:
> >>>>>> I've had a look through it but couldn't find any reference to
> >>>>>> hibernate
> >>>>>> so far, its entirely
> >>>>>> possible that I managed to miss it while I was searching though
> >>>>>>
> >>>>>> Best Regards
> >>>>>> James Pollard
> >>>>>> james.poll...@iinet.net.au
> >>>>>>
> >>>>>> On 19/12/22 5:06 pm, Ernesto Reinaldo Barreiro wrote:
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> This project
> >>>>>>>
> >>>>>>> https://github.com/MarcGiffing/wicket-spring-boot
> >>>>>>>
> >>>>>>> contains a sample project that integrates with JPA/hibernate.
> >>>>>>>
> >>>>>>>
> >>>>>>> On Mon, Dec 19, 2022 at 9:12 AM James 
> >>>>>> wrote:
> >>>>>>>> Hi,
> >>>>>>>> can anyone direct me to any resources on how to integrate
> >>>>>>>> hibernate
> >>>> for
> >>>>>>>> data persistence?
> >>>>>>>>
> >>>>>>>> the closest I've managed to find is
> >>>>>>>>
> >>>>>>>>
> >>>>
> https://www.infoworld.com/article/2077901/web-development-with-wicket--part-3--many-ways-to-persist.html?page=7
> >>>>
> >>>>>>>> but there's still things that are confusing me on how to
> >>>>>>>> ingrate an
> >>>>>>>> authenticated application with hibernate
> >>>>>>>>
> >>>>>>>> --
> >>>>>>>> Best Regards
> >>>>>>>> James Pollard
> >>>>>>>> james.poll...@iinet.net.au
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> -
> >>>>>>>>
> >>>>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >>>>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
> >>>>>>>>
> >>>>>>>>
> >>>>>>
> -
> >>>>>>
> >>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
> >>>>>>
> >>>>>>
> >>>>
> >>>> -
> >>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >>>> For additional commands, e-mail: users-h...@wicket.apache.org
> >>>
> >>>
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: data persistence using hibernate

2023-01-23 Thread James Pollard
 persistence?

the closest I've managed to find is


https://www.infoworld.com/article/2077901/web-development-with-wicket--part-3--many-ways-to-persist.html?page=7 

but there's still things that are confusing me on how to 
ingrate an

authenticated application with hibernate

--
Best Regards
James Pollard
james.poll...@iinet.net.au


- 


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


- 


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




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






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




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




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



Re: data persistence using hibernate

2022-12-26 Thread Vit Rozkovec





But I'm not sure where to put the following parts
Session sess = sessionFactory.openSession();
ManagedSessionContext.bind(sess);


This is done in some utility method when you retrieve the session for 
the first time in the request.


You should also check if the session is already bound by calling

ManagedSessionContext.hasBind(SessionFactory factory)

and binding it only once per request.




unbindSessionFactory


I have this in my custom implementation of 
IRequestCycleListener.onEndRequest(RequestCycle cycle)


that you add in Application.init() method

getRequestCycleListeners().add(new DataRequestCycleListener());

To be honest, I've until now stayed away from Spring as it still seems 
to me as a too much of a black box that I didn't find a time to invest 
in learning it, so I may not be the right person to give you advice, 
because my solution may not be the best one either, although it seems to 
be as javadoc of the ManagedSessionContext suggests. The solution I now 
use took heavy inspiration in old old, now nonexistent, Databinder that 
came around the time Wicket 1.2 or so and when I was tasked to select 
new java framework after landing my first job and found Wicket. Old 
times :D.


Vit





Thank you for the help so far both of you, I've probably made mistakes 
with implement parts

of the previously outlined process.
I've come from experimenting with javafx so wicket has been a radical 
change of direction for me
so far. But since there is very little in the way of examples for 
database integration I'm struggling
to get my head around how to implement it correctly, as well as 
knowing for sure whether I've

done it correctly

Best Regards
James Pollard
james.poll...@iinet.net.au

On 23/12/22 10:16 am, Ernesto Reinaldo Barreiro wrote:

Hi James,

On Thu, Dec 22, 2022 at 2:24 PM James  
wrote:



Thanks for the guidance so far, that pointed me to find additional
resources on JPA
I believe I have this configured correctly, but I'm confused about how
to integrate JPA/Hibernate into a
pure wicket authenticated web application project since the resource 
you

directed me to previously
seems to be more heavily on the spring side of things.

This is true. I have used Hibernate/JPA without the SpringBoot 
parts... But

those projects are private: some owned by me, others no.



Thank you for accommodating all my questions and misunderstandings so
far, I tend to use a reverse
engineer learning style so it's helped me immensely.

Glad to be of some help. This is why this place is for.



I've included screenshots of the project file list and the application
class in the hopes that it makes


They didn't



understanding what I'm trying to convey easier

Best Regards
James Pollard
james.poll...@iinet.net.au

On 20/12/22 12:58 pm, Ernesto Reinaldo Barreiro wrote:
https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/model/Customer.java 


This defines a JPA entity and this JPA/Hibernate


https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/resources/application.yml 


Project uses Spring magic I guess and will start a Hibernate with H2.
Wicket is also started via SpringBoot.


On Tue, Dec 20, 2022 at 7:44 AM James 

wrote:
I've had a look through it but couldn't find any reference to 
hibernate

so far, its entirely
possible that I managed to miss it while I was searching though

Best Regards
James Pollard
james.poll...@iinet.net.au

On 19/12/22 5:06 pm, Ernesto Reinaldo Barreiro wrote:

Hi,

This project

https://github.com/MarcGiffing/wicket-spring-boot

contains a sample project that integrates with JPA/hibernate.


On Mon, Dec 19, 2022 at 9:12 AM James 

wrote:

Hi,
can anyone direct me to any resources on how to integrate hibernate

for

data persistence?

the closest I've managed to find is


https://www.infoworld.com/article/2077901/web-development-with-wicket--part-3--many-ways-to-persist.html?page=7 


but there's still things that are confusing me on how to ingrate an
authenticated application with hibernate

--
Best Regards
James Pollard
james.poll...@iinet.net.au


- 


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



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




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






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

Re: data persistence using hibernate

2022-12-23 Thread James Pollard

Thanks Vit,

I've defined the hibernate.cfg.xml file

I've defined the following globally in the Application class
private Configuration config = new Configuration();
private ServiceRegistry serviceRegistry;
private SessionFactory sessionFactory;

I've placed the following at the end of the init function
config.configure("hibernate.cfg.xml");
config.setProperty("hibernate.current_session_context_class", "managed");
serviceRegistry = new 
StandardServiceRegistryBuilder().applySettings(config.getProperties()).build();

sessionFactory = config.buildSessionFactory(serviceRegistry);

But I'm not sure where to put the following parts
Session sess = sessionFactory.openSession();
ManagedSessionContext.bind(sess);

unbindSessionFactory


Thank you for the help so far both of you, I've probably made mistakes 
with implement parts

of the previously outlined process.
I've come from experimenting with javafx so wicket has been a radical 
change of direction for me
so far. But since there is very little in the way of examples for 
database integration I'm struggling
to get my head around how to implement it correctly, as well as knowing 
for sure whether I've

done it correctly

Best Regards
James Pollard
james.poll...@iinet.net.au

On 23/12/22 10:16 am, Ernesto Reinaldo Barreiro wrote:

Hi James,

On Thu, Dec 22, 2022 at 2:24 PM James  wrote:


Thanks for the guidance so far, that pointed me to find additional
resources on JPA
I believe I have this configured correctly, but I'm confused about how
to integrate JPA/Hibernate into a
pure wicket authenticated web application project since the resource you
directed me to previously
seems to be more heavily on the spring side of things.


This is true. I have used Hibernate/JPA without the SpringBoot parts... But
those projects are private: some owned by me, others no.



Thank you for accommodating all my questions and misunderstandings so
far, I tend to use a reverse
engineer learning style so it's helped me immensely.

Glad to be of some help. This is why this place is for.



I've included screenshots of the project file list and the application
class in the hopes that it makes


They didn't



understanding what I'm trying to convey easier

Best Regards
James Pollard
james.poll...@iinet.net.au

On 20/12/22 12:58 pm, Ernesto Reinaldo Barreiro wrote:
https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/model/Customer.java

This defines a JPA entity and this JPA/Hibernate



https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/resources/application.yml

Project uses Spring magic I guess and will start a Hibernate with H2.
Wicket is also started via SpringBoot.


On Tue, Dec 20, 2022 at 7:44 AM James 

wrote:

I've had a look through it but couldn't find any reference to hibernate
so far, its entirely
possible that I managed to miss it while I was searching though

Best Regards
James Pollard
james.poll...@iinet.net.au

On 19/12/22 5:06 pm, Ernesto Reinaldo Barreiro wrote:

Hi,

This project

https://github.com/MarcGiffing/wicket-spring-boot

contains a sample project that integrates with JPA/hibernate.


On Mon, Dec 19, 2022 at 9:12 AM James 

wrote:

Hi,
can anyone direct me to any resources on how to integrate hibernate

for

data persistence?

the closest I've managed to find is



https://www.infoworld.com/article/2077901/web-development-with-wicket--part-3--many-ways-to-persist.html?page=7

but there's still things that are confusing me on how to ingrate an
authenticated application with hibernate

--
Best Regards
James Pollard
james.poll...@iinet.net.au


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



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




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






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



Re: data persistence using hibernate

2022-12-22 Thread Ernesto Reinaldo Barreiro
Hi James,

On Thu, Dec 22, 2022 at 2:24 PM James  wrote:

> Thanks for the guidance so far, that pointed me to find additional
> resources on JPA
> I believe I have this configured correctly, but I'm confused about how
> to integrate JPA/Hibernate into a
> pure wicket authenticated web application project since the resource you
> directed me to previously
> seems to be more heavily on the spring side of things.
>

This is true. I have used Hibernate/JPA without the SpringBoot parts... But
those projects are private: some owned by me, others no.


> Thank you for accommodating all my questions and misunderstandings so
> far, I tend to use a reverse
> engineer learning style so it's helped me immensely.
>
> Glad to be of some help. This is why this place is for.


> I've included screenshots of the project file list and the application
> class in the hopes that it makes
>
They didn't


> understanding what I'm trying to convey easier
>
> Best Regards
> James Pollard
> james.poll...@iinet.net.au
>
> On 20/12/22 12:58 pm, Ernesto Reinaldo Barreiro wrote:
> >
> https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/model/Customer.java
> >
> > This defines a JPA entity and this JPA/Hibernate
> >
> >
> https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/resources/application.yml
> >
> > Project uses Spring magic I guess and will start a Hibernate with H2.
> > Wicket is also started via SpringBoot.
> >
> >
> > On Tue, Dec 20, 2022 at 7:44 AM James 
> wrote:
> >
> >> I've had a look through it but couldn't find any reference to hibernate
> >> so far, its entirely
> >> possible that I managed to miss it while I was searching though
> >>
> >> Best Regards
> >> James Pollard
> >> james.poll...@iinet.net.au
> >>
> >> On 19/12/22 5:06 pm, Ernesto Reinaldo Barreiro wrote:
> >>> Hi,
> >>>
> >>> This project
> >>>
> >>> https://github.com/MarcGiffing/wicket-spring-boot
> >>>
> >>> contains a sample project that integrates with JPA/hibernate.
> >>>
> >>>
> >>> On Mon, Dec 19, 2022 at 9:12 AM James 
> >> wrote:
> >>>> Hi,
> >>>> can anyone direct me to any resources on how to integrate hibernate
> for
> >>>> data persistence?
> >>>>
> >>>> the closest I've managed to find is
> >>>>
> >>>>
> >>
> https://www.infoworld.com/article/2077901/web-development-with-wicket--part-3--many-ways-to-persist.html?page=7
> >>>> but there's still things that are confusing me on how to ingrate an
> >>>> authenticated application with hibernate
> >>>>
> >>>> --
> >>>> Best Regards
> >>>> James Pollard
> >>>> james.poll...@iinet.net.au
> >>>>
> >>>>
> >>>> -
> >>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >>>> For additional commands, e-mail: users-h...@wicket.apache.org
> >>>>
> >>>>
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org



-- 
Regards - Ernesto Reinaldo Barreiro


Re: data persistence using hibernate

2022-12-22 Thread Vit Rozkovec

Hi,

I'm currently using Hibernate without Spring and what you want to 
achieve can be done in several steps:


- prepare your org.hibernate.cfg.Configuration
- set Configuration's property: 
config.setProperty("hibernate.current_session_context_class", "managed");

- get SessionFactory by caling org.hibernate.cfg.Configuration.build()
- store SessionFactory's instance somewhere and keep it for the duration 
of your application

- when you request a session, bind it:
Session sess = sessionFactory.openSession();
ManagedSessionContext.bind(sess);

- at the end of request cycle, unbind SessionFactory. Implement your own 
IRequestCycleListener and in IRequestCycleListener.onEndRequest call 
unbind logic.

Here's what I use:

public void unbindSessionFactory(Object key, boolean closeSessionFactory)
    {
    SessionFactory sf = getHibernateSessionFactory(key);

    if (hasBoundSession(sf))
    {
        Session sess = sf.getCurrentSession();

        if (sess.isOpen())
        {
            try
            {
                if (sess.getTransaction().isActive())
                {
                    sess.getTransaction().rollback();
                }
            }
            finally
            {
                sess.close();
            }
        }

        ManagedSessionContext.unbind(sf);

        if (closeSessionFactory)
            sf.close();
    }
    }

- when application exits, close session factory

Hope that helped.

Vit



On 22. 12. 22 8:23, James wrote:
Thanks for the guidance so far, that pointed me to find additional 
resources on JPA
I believe I have this configured correctly, but I'm confused about how 
to integrate JPA/Hibernate into a
pure wicket authenticated web application project since the resource 
you directed me to previously

seems to be more heavily on the spring side of things.

Thank you for accommodating all my questions and misunderstandings so 
far, I tend to use a reverse

engineer learning style so it's helped me immensely.

I've included screenshots of the project file list and the application 
class in the hopes that it makes

understanding what I'm trying to convey easier

Best Regards
James Pollard
james.poll...@iinet.net.au

On 20/12/22 12:58 pm, Ernesto Reinaldo Barreiro wrote:
https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/model/Customer.java 



This defines a JPA entity and this JPA/Hibernate

https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/resources/application.yml 



Project uses Spring magic I guess and will start a Hibernate with H2.
Wicket is also started via SpringBoot.


On Tue, Dec 20, 2022 at 7:44 AM James  
wrote:



I've had a look through it but couldn't find any reference to hibernate
so far, its entirely
possible that I managed to miss it while I was searching though

Best Regards
James Pollard
james.poll...@iinet.net.au

On 19/12/22 5:06 pm, Ernesto Reinaldo Barreiro wrote:

Hi,

This project

https://github.com/MarcGiffing/wicket-spring-boot

contains a sample project that integrates with JPA/hibernate.


On Mon, Dec 19, 2022 at 9:12 AM James 

wrote:

Hi,
can anyone direct me to any resources on how to integrate 
hibernate for

data persistence?

the closest I've managed to find is


https://www.infoworld.com/article/2077901/web-development-with-wicket--part-3--many-ways-to-persist.html?page=7 


but there's still things that are confusing me on how to ingrate an
authenticated application with hibernate

--
Best Regards
James Pollard
james.poll...@iinet.net.au


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




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





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




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



Re: data persistence using hibernate

2022-12-21 Thread James
Thanks for the guidance so far, that pointed me to find additional 
resources on JPA
I believe I have this configured correctly, but I'm confused about how 
to integrate JPA/Hibernate into a
pure wicket authenticated web application project since the resource you 
directed me to previously

seems to be more heavily on the spring side of things.

Thank you for accommodating all my questions and misunderstandings so 
far, I tend to use a reverse

engineer learning style so it's helped me immensely.

I've included screenshots of the project file list and the application 
class in the hopes that it makes

understanding what I'm trying to convey easier

Best Regards
James Pollard
james.poll...@iinet.net.au

On 20/12/22 12:58 pm, Ernesto Reinaldo Barreiro wrote:

https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/model/Customer.java

This defines a JPA entity and this JPA/Hibernate

https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/resources/application.yml

Project uses Spring magic I guess and will start a Hibernate with H2.
Wicket is also started via SpringBoot.


On Tue, Dec 20, 2022 at 7:44 AM James  wrote:


I've had a look through it but couldn't find any reference to hibernate
so far, its entirely
possible that I managed to miss it while I was searching though

Best Regards
James Pollard
james.poll...@iinet.net.au

On 19/12/22 5:06 pm, Ernesto Reinaldo Barreiro wrote:

Hi,

This project

https://github.com/MarcGiffing/wicket-spring-boot

contains a sample project that integrates with JPA/hibernate.


On Mon, Dec 19, 2022 at 9:12 AM James 

wrote:

Hi,
can anyone direct me to any resources on how to integrate hibernate for
data persistence?

the closest I've managed to find is



https://www.infoworld.com/article/2077901/web-development-with-wicket--part-3--many-ways-to-persist.html?page=7

but there's still things that are confusing me on how to ingrate an
authenticated application with hibernate

--
Best Regards
James Pollard
james.poll...@iinet.net.au


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




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





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

Re: data persistence using hibernate

2022-12-19 Thread Ernesto Reinaldo Barreiro
https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/model/Customer.java

This defines a JPA entity and this JPA/Hibernate

https://github.com/MarcGiffing/wicket-spring-boot/blob/master/wicket-spring-boot-starter-example/src/main/resources/application.yml

Project uses Spring magic I guess and will start a Hibernate with H2.
Wicket is also started via SpringBoot.


On Tue, Dec 20, 2022 at 7:44 AM James  wrote:

> I've had a look through it but couldn't find any reference to hibernate
> so far, its entirely
> possible that I managed to miss it while I was searching though
>
> Best Regards
> James Pollard
> james.poll...@iinet.net.au
>
> On 19/12/22 5:06 pm, Ernesto Reinaldo Barreiro wrote:
> > Hi,
> >
> > This project
> >
> > https://github.com/MarcGiffing/wicket-spring-boot
> >
> > contains a sample project that integrates with JPA/hibernate.
> >
> >
> > On Mon, Dec 19, 2022 at 9:12 AM James 
> wrote:
> >
> >> Hi,
> >> can anyone direct me to any resources on how to integrate hibernate for
> >> data persistence?
> >>
> >> the closest I've managed to find is
> >>
> >>
> https://www.infoworld.com/article/2077901/web-development-with-wicket--part-3--many-ways-to-persist.html?page=7
> >> but there's still things that are confusing me on how to ingrate an
> >> authenticated application with hibernate
> >>
> >> --
> >> Best Regards
> >> James Pollard
> >> james.poll...@iinet.net.au
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

-- 
Regards - Ernesto Reinaldo Barreiro


Re: data persistence using hibernate

2022-12-19 Thread James
I've had a look through it but couldn't find any reference to hibernate 
so far, its entirely

possible that I managed to miss it while I was searching though

Best Regards
James Pollard
james.poll...@iinet.net.au

On 19/12/22 5:06 pm, Ernesto Reinaldo Barreiro wrote:

Hi,

This project

https://github.com/MarcGiffing/wicket-spring-boot

contains a sample project that integrates with JPA/hibernate.


On Mon, Dec 19, 2022 at 9:12 AM James  wrote:


Hi,
can anyone direct me to any resources on how to integrate hibernate for
data persistence?

the closest I've managed to find is

https://www.infoworld.com/article/2077901/web-development-with-wicket--part-3--many-ways-to-persist.html?page=7
but there's still things that are confusing me on how to ingrate an
authenticated application with hibernate

--
Best Regards
James Pollard
james.poll...@iinet.net.au


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





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



Re: data persistence using hibernate

2022-12-18 Thread Ernesto Reinaldo Barreiro
Hi,

This project

https://github.com/MarcGiffing/wicket-spring-boot

contains a sample project that integrates with JPA/hibernate.


On Mon, Dec 19, 2022 at 9:12 AM James  wrote:

> Hi,
> can anyone direct me to any resources on how to integrate hibernate for
> data persistence?
>
> the closest I've managed to find is
>
> https://www.infoworld.com/article/2077901/web-development-with-wicket--part-3--many-ways-to-persist.html?page=7
> but there's still things that are confusing me on how to ingrate an
> authenticated application with hibernate
>
> --
> Best Regards
> James Pollard
> james.poll...@iinet.net.au
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

-- 
Regards - Ernesto Reinaldo Barreiro


data persistence using hibernate

2022-12-18 Thread James

Hi,
can anyone direct me to any resources on how to integrate hibernate for 
data persistence?


the closest I've managed to find is
https://www.infoworld.com/article/2077901/web-development-with-wicket--part-3--many-ways-to-persist.html?page=7
but there's still things that are confusing me on how to ingrate an 
authenticated application with hibernate


--
Best Regards
James Pollard
james.poll...@iinet.net.au


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



Re: Ajaxbutton, updating forms, broken persistence: strange, seemingly unrelated behaviour

2012-06-20 Thread lucast
Thank you, Sven.

In my code I was not calling LoadableDetachableModel.detach() after
persisting objects to the database. Something I should have done.

As for the new events mechanism, I just had a look at the Migration to
Wicket 1.5 and it looks like it's just what I need. The example from the
wicket-example page is clear and concise. This will indeed untangle my
code as you rightly put it.

I shall read the Migration to Wicket 1.5 document as up until now I was more
concern of having my code up and running and charging ahead with having my
1.4 code working on 1.5.

Thanks for your help,
Lucas

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajaxbutton-updating-forms-broken-persistence-strange-seemingly-unrelated-behaviour-tp4650049p4650112.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Ajaxbutton, updating forms, broken persistence: strange, seemingly unrelated behaviour

2012-06-19 Thread Sven Meier

Hi,

without code its difficult to say what's going wrong in your project.

wicket-dnd uses normal Wicke ajax request, so you can do anything what 
you would do with any other ajax enabled component: change models and 
components.


The way I did this is I passed the parent tabbed panel wrapped in an Model
all the way down to the wicketDnD table cells and from there I unwrap the
parent tabbed panel and call parentTabbedPanel.makeButtonVisible(),
passing the AjaxRequestTarget object from the wicketDnD object.

This sounds a little bit complicated, perhaps using the new event 
mechanism would help to untangled this?


Now, even calling LoadableDetachableModel.getObject() will not return 
updated objects from the DB.


Usually you'll have to call detach() on you LDM if you change something 
in the DB, e.g. add or remove a record. Are you doing this?


Hope this helps
Sven


On 06/19/2012 10:57 AM, lucast wrote:

Dear Forum,
I apologise for this long post.

1) I have a long nested structure of panels: a tabbed panel containing the
main panel, which holds a dynamically created table and each table cell has
a small panel with wicketDnD functionality.

2) I wanted the tabbed to have a small panel with labels and have an ajax
button made visible whenever something is dropped on the wicketDnD table
cells.

3) Within the wicketDnD table cells onDrop(AjaxRequestTarget target,
Transfer transfer, Location location) and onAfterDrop(AjaxRequestTarget
target, Transfer transfer) I persist objects to the database using standard
hibernate calls.

4)This worked fine until I implemented the functionality described in 2).
The way I did this is I passed the parent tabbed panel wrapped in an Model
all the way down to the wicketDnD table cells and from there I unwrap the
parent tabbed panel and call parentTabbedPanel.makeButtonVisible(), passing
the AjaxRequestTarget object from the wicketDnD object.

Now, even calling LoadableDetachableModel.getObject() will not return
updated objects from the DB.

This, strangely enough, only happens the third time I make use of
wicketDnD.onDrop() or wicketDnD.onAfterDrop().
I am loosing the hibernate session. But this didn't happen before I
implemented 2) (described above).

So:
I don't know if the way I implemented 4) is the right way to implement such
functionality
And
How could this Ajax behaviour have broken the hibernate session?

I am utterly baffled.
Thanks in advance,
Lucas



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajaxbutton-updating-forms-broken-persistence-strange-seemingly-unrelated-behaviour-tp4650049.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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



Persistence.

2012-05-08 Thread JASON HOLT




I'll repeat my plea for patience as I'm new to Java and Wicket, but have some 
minimal experience with ASP.net forms (not MVC). I've reached that point in the 
learning process where I want to interact with a database and I wish to use 
entities and Hibernate to make it easier. From what I've seen in various blogs 
and forums, some say you shouldn't use entities as models, yet others do it 
with LDMs. Since I'm taking baby steps, I want to start by using entities as 
models, unless someone convinces me I'm wasting my time. Following the basic 
Hibernate tutorials for persisting simple classes, I've managed to make the 
following work in Wicket. In the LDM load... @Override
public Person load()
{
   Session session =  WicketApp.sessionFactory.openSession();
   session.beginTransaction();
   Person person = (Person) session.get(Person.class, 1L);
   session.getTransaction().commit();
   session.close();
   return person;
} In the form I update the evil entity model with text boxes, using a CPM 
containing the LDM. In the submit button... public void onSubmit()
{
   Session session = WicketApp.sessionFactory.openSession();
   session.beginTransaction();
   session.update(ldm.getObject());
   session.getTransaction().commit();
   session.close();   this.setResponsePage(EndPage.class);
} The sessionFactory is a static member of the WicketApp application class, 
initialized in the init() method. This seems to work, but I suppose there are 
all kinds of faulty design patterns used here. My main concern is... how can I 
do this without opening a new Hibernate session in onSubmit()? During postback, 
I think I should be able to reuse the same session opened at ldm.load() in 
onSubmit() also, as it all occurs in the same request. Is this possible? Thanks 
for your assistance. Please feel free to point out every flaw.  
  

Re: Persistence.

2012-05-08 Thread Richard W. Adams
Gosh, you can use Hibernate if you want, but I write plain DAO classes 
with JDBC  Wicket  they work just fine. No fuss, no muss. Just my take 
on it, though. I know there are some that like Hibernate. But try as I 
might, I've never been able to justify yet another third party library for 
my needs.

There are three kinds of lies: lies, damn lies, and statistics.
Benjamin Disraeli

Then there was the man who drowned crossing a stream with an average 
depth of six inches.
W. I. E. Gates




From:   JASON HOLT j_holt5...@msn.com
To: users@wicket.apache.org
Date:   05/08/2012 03:37 PM
Subject:Persistence.







I'll repeat my plea for patience as I'm new to Java and Wicket, but have 
some minimal experience with ASP.net forms (not MVC). I've reached that 
point in the learning process where I want to interact with a database and 
I wish to use entities and Hibernate to make it easier. From what I've 
seen in various blogs and forums, some say you shouldn't use entities as 
models, yet others do it with LDMs. Since I'm taking baby steps, I want to 
start by using entities as models, unless someone convinces me I'm wasting 
my time. Following the basic Hibernate tutorials for persisting simple 
classes, I've managed to make the following work in Wicket. In the LDM 
load... @Override
public Person load()
{
   Session session =  WicketApp.sessionFactory.openSession();
   session.beginTransaction();
   Person person = (Person) session.get(Person.class, 1L);
   session.getTransaction().commit();
   session.close();
   return person;
} In the form I update the evil entity model with text boxes, using a CPM 
containing the LDM. In the submit button... public void onSubmit()
{
   Session session = WicketApp.sessionFactory.openSession();
   session.beginTransaction();
   session.update(ldm.getObject());
   session.getTransaction().commit();
   session.close();   this.setResponsePage(EndPage.class);
} The sessionFactory is a static member of the WicketApp application 
class, initialized in the init() method. This seems to work, but I suppose 
there are all kinds of faulty design patterns used here. My main concern 
is... how can I do this without opening a new Hibernate session in 
onSubmit()? During postback, I think I should be able to reuse the same 
session opened at ldm.load() in onSubmit() also, as it all occurs in the 
same request. Is this possible? Thanks for your assistance. Please feel 
free to point out every flaw.  


**

This email and any attachments may contain information that is confidential 
and/or privileged for the sole use of the intended recipient.  Any use, review, 
disclosure, copying, distribution or reliance by others, and any forwarding of 
this email or its contents, without the express permission of the sender is 
strictly prohibited by law.  If you are not the intended recipient, please 
contact the sender immediately, delete the e-mail and destroy all copies.
**


Re: Persistence.

2012-05-08 Thread James Carman
You should take a look at some of the RAD tools for persistence with
Wicket.  I wrote a library called Wicketopia that can probably help
you get started.

On Tue, May 8, 2012 at 4:35 PM, JASON HOLT j_holt5...@msn.com wrote:




 I'll repeat my plea for patience as I'm new to Java and Wicket, but have some 
 minimal experience with ASP.net forms (not MVC). I've reached that point in 
 the learning process where I want to interact with a database and I wish to 
 use entities and Hibernate to make it easier. From what I've seen in various 
 blogs and forums, some say you shouldn't use entities as models, yet others 
 do it with LDMs. Since I'm taking baby steps, I want to start by using 
 entities as models, unless someone convinces me I'm wasting my time. 
 Following the basic Hibernate tutorials for persisting simple classes, I've 
 managed to make the following work in Wicket. In the LDM load... @Override
 public Person load()
 {
   Session session =  WicketApp.sessionFactory.openSession();
   session.beginTransaction();
   Person person = (Person) session.get(Person.class, 1L);
   session.getTransaction().commit();
   session.close();
   return person;
 } In the form I update the evil entity model with text boxes, using a CPM 
 containing the LDM. In the submit button... public void onSubmit()
 {
   Session session = WicketApp.sessionFactory.openSession();
   session.beginTransaction();
   session.update(ldm.getObject());
   session.getTransaction().commit();
   session.close();   this.setResponsePage(EndPage.class);
 } The sessionFactory is a static member of the WicketApp application class, 
 initialized in the init() method. This seems to work, but I suppose there are 
 all kinds of faulty design patterns used here. My main concern is... how can 
 I do this without opening a new Hibernate session in onSubmit()? During 
 postback, I think I should be able to reuse the same session opened at 
 ldm.load() in onSubmit() also, as it all occurs in the same request. Is this 
 possible? Thanks for your assistance. Please feel free to point out every 
 flaw.

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



Re: Page/Session persistence on AppEngine

2012-03-30 Thread Per
Hi Chris,

we encountered similar problems, and wrote two blogposts: One about tweaking
all the components, one about zipping the session. 

http://www.small-improvements.com/blog/technical/tuning-wicket-session-size
http://blog.small-improvements.com/2012/02/19/reducing-wicket-session-size-to-one-third/

You should use a proper profiler (e.g. JProfiler) to figure out the size of
your pages and objects, much more efficient than logging stuff youself. And
then also you can also write a custom IPageMapEvictionStrategy that takes
session size into consideration when evicting pages (e.g. you evict so many
pages until the session size is below 1MB again). That's the last resort
only, but helps avoiding the nasty blank exception page.

All combined, you should be able to work around the session size issue.

Cheers,
Per


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Page-Session-persistence-on-AppEngine-tp4475827p4518388.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Page/Session persistence on AppEngine

2012-03-16 Thread Martin Grigorov
Hi,

Read https://cwiki.apache.org/confluence/display/WICKET/Page+Storage
You need custom IDataStore. By default Wicket uses DiskDataStore. With
GAE-initializer this is replaced with HttpSessionDataStore, see
org.apache.wicket.pageStore.memory.DataStoreEvictionStrategy as well.
You'll need to implement IDataStore impl based on
http://code.google.com/appengine/docs/java/datastore/

Good luck and as always - wicketstuff-gae-initializer will be glad to
accept your donations!

On Thu, Mar 15, 2012 at 7:56 PM, Chris Merrill ch...@webperformance.com wrote:
 So I've got a problem with my sessions getting too big on AppEngine. I've 
 already
 done some of the more obvious optimizations, but before going further, I'd 
 like
 to get some insight into how many pages are being stored in the page map and
 how big they are.

 I traversed down into PageStoreManager and found where the pages are 
 serialized
 in PageStoreManager.SessionEntry.writeObject() and think that I can put some
 diagnostics in there to illuminate the situation.

 However, I don't know how to convince GAE and/or Wicket to store the session
 to persistent storage in the AppEngine development environment (or in 
 Wicket?).

 Can anyone point me in the right direction?  Perhaps somewhere I can read up
 on the right parts of the mechanism?  I'm not even sure what keywords I should
 be searching on...or if this is an AppEngine or Wicket topic...or both?

 TIA!
 Chris


 --
  -
 Chris Merrill                           |  Web Performance, Inc.
 ch...@webperformance.com                |  http://webperformance.com
 919-433-1762                            |  919-845-7601

 Web Performance: Website Load Testing Software  Services
  -

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Page/Session persistence on AppEngine

2012-03-15 Thread Chris Merrill
So I've got a problem with my sessions getting too big on AppEngine. I've 
already
done some of the more obvious optimizations, but before going further, I'd like
to get some insight into how many pages are being stored in the page map and
how big they are.

I traversed down into PageStoreManager and found where the pages are serialized
in PageStoreManager.SessionEntry.writeObject() and think that I can put some
diagnostics in there to illuminate the situation.

However, I don't know how to convince GAE and/or Wicket to store the session
to persistent storage in the AppEngine development environment (or in Wicket?).

Can anyone point me in the right direction?  Perhaps somewhere I can read up
on the right parts of the mechanism?  I'm not even sure what keywords I should
be searching on...or if this is an AppEngine or Wicket topic...or both?

TIA!
Chris


-- 
 -
Chris Merrill   |  Web Performance, Inc.
ch...@webperformance.com|  http://webperformance.com
919-433-1762|  919-845-7601

Web Performance: Website Load Testing Software  Services
 -

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



Re: Unwanted authentication persistence

2011-06-30 Thread Scott Reed
I figured out that the sign-in panel was storing the authentication data 
in a cookie from when we had first tried it before we turned off the 
remember-me option and now it's getting it back from there even though 
we have turned off that option. Was a simple tweak to fix it.


On 6/28/2011 3:15 PM, sreed wrote:

We are using Jetty which has no session persistence by default. Is it
possible that Wicket is persisting sessions somehow? What else might be
causing this?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Unwanted-authentication-persistence-tp3631027p3631188.html
Sent from the Users forum mailing list archive at Nabble.com.

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



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



Unwanted authentication persistence

2011-06-28 Thread sreed
We are using AuthenticatedWebSession without any persistence of anything.
However, the session is persisting (user does not have to login after the
first time) from one server restart to another. Is that expected behavior?
Does anyone know how to prevent persistence of the session/data?
Thanks,
  Scott

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Unwanted-authentication-persistence-tp3631027p3631027.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Unwanted authentication persistence

2011-06-28 Thread Martin Grigorov
This is a feature of the web container.
You have to check its user manual :-)

On Tue, Jun 28, 2011 at 9:09 PM, sreed sr...@avacoda.com wrote:
 We are using AuthenticatedWebSession without any persistence of anything.
 However, the session is persisting (user does not have to login after the
 first time) from one server restart to another. Is that expected behavior?
 Does anyone know how to prevent persistence of the session/data?
 Thanks,
  Scott

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Unwanted-authentication-persistence-tp3631027p3631027.html
 Sent from the Users forum mailing list archive at Nabble.com.

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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Unwanted authentication persistence

2011-06-28 Thread sreed
We are using Jetty which has no session persistence by default. Is it
possible that Wicket is persisting sessions somehow? What else might be
causing this?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Unwanted-authentication-persistence-tp3631027p3631188.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Persistence Error with Wicket.

2009-07-30 Thread Erik Post
Hi Raphael,

You're using JPA, which complains that it can't find a persistence
provider (i.e. Hibernate). Have you added the JPA-specific Hibernate
jars such as hibernate-entitymanager.jar (and, while you're at it,
hibernate-annotations.jar) as well? And where did you put your
persistence.xml? Also, please include the relevant bits of your
persistence.xml file, in particular:

  persistence-unit name=foo transaction-type=RESOURCE_LOCAL
providerorg.hibernate.ejb.HibernatePersistence/provider
 !-- ... --
  /persistence-unit

This does not seem to be a Wicket-specific problem btw, althoug it may
have something to do with your project's directory structure.

Cheers,
Erik


On Thu, Jul 30, 2009 at 10:07 PM, Raphael Monroe - Leucotron
(DES)rmon...@leucotron.com.br wrote:
 Hi everyone,

 It愀 my first post to the list so I'm sorry if I'm broking any rules or
 writing in a wrong text format.
 I'm here to learn and I hope I'll with you guys.

 Firstly, I should explain my huge(or not?) problem.
 Since 2 days ago, I'm having this persistence error in my project.

 I mean, when I get my program running, I have this follow message:

 javax.persistence.PersistenceException: No Persistence provider for
 EntityManager named classePer
 at 
 javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:56)
       at 
 com.leucotron.database.JDataBaseConnection.init(JDataBaseConnection.java:34)
       at  
 com.leucotron.database.JDataBaseConnection.getInstance(JDataBaseConnection.java:41)
       at com.leucotron.exemplowicket.Testando.init(Testando.java:24)


 I have no idea why I'm having this. Then, I have thought that is a wicket
 problem because when I use the same codes in a Desktop application I can run
 that very normal.

 I've tried to put the persistence.xml in several places, but I didn't have
 any sucess so far.
 I've also tried to add (even manually), all the .jars related to the
 hibernate lib. However, I still continued with the same problem.

 I kinda lost myself and I do not know how to fix my code or even how to do
 any modification to get my web application running as normal as my desktop
 application.

 Thank you guys,

 []s

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



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



OT: Using persistence layer objects for service results?

2009-06-10 Thread Kaspar Fischer
I am looking for a good pattern/methodology to use when coding  
services in small Wicket webapps. I want to use the services from  
Wicket but it will also be exposed via RMI and SOAP/REST. For example,  
a service for Houses and Inhabitants might have methods like this:


  // Returns the houses matching the filter (but not yet the  
inhabitants)

  ListHouse findHouses(House filter);

  // Returns the inhabitants of the given house
  ListInhabitant getInhabitants(int houseId);

The class House exposes an id (for use in the getInhabitants() method)  
and some data (address, etc.). It does not provide the list of  
inhabitants because this list might be huge, might not be needed by  
the caller at all, etc. The service returns lists because this comes  
in handy with Wicket components.


My question: Should the above service return objects (HouseImpl,  
InhabitantImpl) from the persistence layer? Or do you introduce  
another set of public (DTO) classes for exposure in the service?


Ideally, I want to keep things simple and manageable, with little code.

For instance, for the above service one could use a Hibernate mapping  
like


  public class HouseImpl
  {
...

@OneToMany(mappedBy = house, fetch = FetchType.LAZY)
private final CollectionInhabitantImpl inhabitants;
  }

and

  public class InhabitantImpl
  {
...

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(nullable = false, updatable = false)
private HouesImpl house;
  }

and the service can directly return instances of these classes. I have  
used this approach in a project and we have seen these problems:


- There's some code used to properly detach the objects and load all  
exposed data in order to avoid LazyInitializationException's. For  
instance, if House has a list of caretakers and you want them to be  
exposed in the service's House, you may need to tell Hibernate to load  
them first. This code is cumbersome to maintain.


- I am not sure whether this would work with RMI, for example. I  
suppose the Hibernate proxies that exist for some of the members would  
get transmitted and would have to exist at the client end, too...


Therefore: How do you design your services? Is anybody using some  
method in which the service objects are generated (semi-)automatically  
from the persistence layer objects?


Many thanks for your input!
Kaspar

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



Re: Integrating Wicket + Google Guice + Warp-persistence

2009-04-08 Thread francisco treacy
if conceptually and technically it works for you then it's fine! very
likely some day someone searching the mailing list is going to find it
useful.

francisco


2009/4/7 Eduardo Nunes esnu...@gmail.com:
 No comments?

 On Tue, Apr 7, 2009 at 10:05 AM, Eduardo Nunes esnu...@gmail.com wrote:
 Hi there,

  After a long period of reading, now I'm starting to code my
 application using these frameworks: Wicket, Google Guice and
 Warp-persistence. I facet a conceptual problem (IMHO) about how
 initialize google guice. I read a lot of source codes on the internet
 and most of them, if not all, initialize Google Guice and
 Warp-persistence inside the WicketApplication class (extends
 WebApplication). I think it isn't a good thing, because in the
 conceptual point of view google guice doesn't have direct relation to
 wicket. So, I started to find a good solution for this problem.
  My solution consists in use Google Guice servlet extension. I think
 that sometimes a source code says more than a thousand words ehehe,
 below are the pastbin links for all envolved files. What I want from
 you is a feedback, suggestions, improvements, critics, etc...

 Files:
 - web.xml
    http://pastebin.com/f576189de

 - GuiceServletContextListener
    http://pastebin.com/f6a42d811

 - WebModule
    http://pastebin.com/f24a797b

 - ServiceModule
    http://pastebin.com/f6e9db66f

 - PersistenceServiceInitializer
    http://pastebin.com/f6e4425fd

 Maybe, and probably, some parts of the pasted source code are based on
 another projects, blogs posts, etc.

 Thanks,
 Eduardo S. Nunes


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



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



Integrating Wicket + Google Guice + Warp-persistence

2009-04-07 Thread Eduardo Nunes
Hi there,

  After a long period of reading, now I'm starting to code my
application using these frameworks: Wicket, Google Guice and
Warp-persistence. I facet a conceptual problem (IMHO) about how
initialize google guice. I read a lot of source codes on the internet
and most of them, if not all, initialize Google Guice and
Warp-persistence inside the WicketApplication class (extends
WebApplication). I think it isn't a good thing, because in the
conceptual point of view google guice doesn't have direct relation to
wicket. So, I started to find a good solution for this problem.
  My solution consists in use Google Guice servlet extension. I think
that sometimes a source code says more than a thousand words ehehe,
below are the pastbin links for all envolved files. What I want from
you is a feedback, suggestions, improvements, critics, etc...

Files:
- web.xml
http://pastebin.com/f576189de

- GuiceServletContextListener
http://pastebin.com/f6a42d811

- WebModule
http://pastebin.com/f24a797b

- ServiceModule
http://pastebin.com/f6e9db66f

- PersistenceServiceInitializer
http://pastebin.com/f6e4425fd

Maybe, and probably, some parts of the pasted source code are based on
another projects, blogs posts, etc.

Thanks,
Eduardo S. Nunes

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



Re: Integrating Wicket + Google Guice + Warp-persistence

2009-04-07 Thread Eduardo Nunes
No comments?

On Tue, Apr 7, 2009 at 10:05 AM, Eduardo Nunes esnu...@gmail.com wrote:
 Hi there,

  After a long period of reading, now I'm starting to code my
 application using these frameworks: Wicket, Google Guice and
 Warp-persistence. I facet a conceptual problem (IMHO) about how
 initialize google guice. I read a lot of source codes on the internet
 and most of them, if not all, initialize Google Guice and
 Warp-persistence inside the WicketApplication class (extends
 WebApplication). I think it isn't a good thing, because in the
 conceptual point of view google guice doesn't have direct relation to
 wicket. So, I started to find a good solution for this problem.
  My solution consists in use Google Guice servlet extension. I think
 that sometimes a source code says more than a thousand words ehehe,
 below are the pastbin links for all envolved files. What I want from
 you is a feedback, suggestions, improvements, critics, etc...

 Files:
 - web.xml
    http://pastebin.com/f576189de

 - GuiceServletContextListener
    http://pastebin.com/f6a42d811

 - WebModule
    http://pastebin.com/f24a797b

 - ServiceModule
    http://pastebin.com/f6e9db66f

 - PersistenceServiceInitializer
    http://pastebin.com/f6e4425fd

 Maybe, and probably, some parts of the pasted source code are based on
 another projects, blogs posts, etc.

 Thanks,
 Eduardo S. Nunes


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



Re: Integrating Wicket + Google Guice + Warp-persistence

2009-04-07 Thread Igor Vaynberg
first!

-igor

On Tue, Apr 7, 2009 at 10:46 AM, Eduardo Nunes esnu...@gmail.com wrote:
 No comments?

 On Tue, Apr 7, 2009 at 10:05 AM, Eduardo Nunes esnu...@gmail.com wrote:
 Hi there,

  After a long period of reading, now I'm starting to code my
 application using these frameworks: Wicket, Google Guice and
 Warp-persistence. I facet a conceptual problem (IMHO) about how
 initialize google guice. I read a lot of source codes on the internet
 and most of them, if not all, initialize Google Guice and
 Warp-persistence inside the WicketApplication class (extends
 WebApplication). I think it isn't a good thing, because in the
 conceptual point of view google guice doesn't have direct relation to
 wicket. So, I started to find a good solution for this problem.
  My solution consists in use Google Guice servlet extension. I think
 that sometimes a source code says more than a thousand words ehehe,
 below are the pastbin links for all envolved files. What I want from
 you is a feedback, suggestions, improvements, critics, etc...

 Files:
 - web.xml
    http://pastebin.com/f576189de

 - GuiceServletContextListener
    http://pastebin.com/f6a42d811

 - WebModule
    http://pastebin.com/f24a797b

 - ServiceModule
    http://pastebin.com/f6e9db66f

 - PersistenceServiceInitializer
    http://pastebin.com/f6e4425fd

 Maybe, and probably, some parts of the pasted source code are based on
 another projects, blogs posts, etc.

 Thanks,
 Eduardo S. Nunes


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



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



Re: setEnabled(false) on FocusableTextField breaks persistence

2007-08-30 Thread Eelco Hillenius
On 8/30/07, janders [EMAIL PROTECTED] wrote:

 I don't think I'm doing a good job communicating what I'm trying to do.

Or maybe it's me not doing a good job explaining what you should do :)

 The markup looks like this (note there is no attribute readonly for input
 field with id=label):

 select wicket:id=type
   optionhome/option
   optionwork/option
   optionother/option
 /select
 input wicket:id=label type=text class=label /

 What I want to do is dynamically set or remove the attribute readonly on the
 input field (label) depending on the dropdownchoice selection (type).  If
 the user selects home or work I want the attribute readonly to be set.
 If the user selects other I want the attribute to be removed so that the
 user can edit label.

 The Java code looks like:

 final AttributeModifier rot = new AttributeModifier(readonly, true, new
 Model(readonly));  // true

 if (email.getType() != EmailAddress.Type.OTHER)

 emailLabel.add(rot);  //  this works, by adding the readonly
 attribute

 item.add(emailLabel);
 item.add(new DropDownChoice(type, emailTypeList) {
 @Override
 protected boolean wantOnSelectionChangedNotifications() {
 return true;
 }
 @Override
 protected void onSelectionChanged(final Object newSelection) {
 if (newSelection == EmailAddress.Type.OTHER) {

 emailLabel.remove ??? ;   //  - I can't figure out how
 to remove the attribute

 emailLabel.requestFocus();
 } else {
 emailLabel.setModelValue(newSelection.toString());
 emailLabel.add(rot);
 }
 }
 });


if (email.getType() != EmailAddress.Type.OTHER)

emailLabel.add(rot);
item.add(emailLabel);

item.add(new DropDownChoice(type, emailTypeList) {
   @Override
   protected boolean wantOnSelectionChangedNotifications() {
   return true;
   }
   @Override
   protected void onSelectionChanged(final Object newSelection) {
   if (newSelection == EmailAddress.Type.OTHER) {
   rot.setEnabled(false);
   emailLabel.requestFocus();
   } else {
   emailLabel.setModelValue(newSelection.toString());
   rot.setEnabled(false);
   }
   }
});


This code always adds the attribute modifier. However, it is disabled
when your use case happens.

 Because I have wantOnSelectionChangedNotifications() set to true, the user
 can select a choice and the label should change accordingly -- i.e., add
 attribute readonly or remove it for the selection of other.

 So the problem that I'm having right now is how do I dynamically remove
 readonly (once added to the input field) when the user selects other from
 the dropdownchoice?

You don't need to remove it. Just turn it off/ on like the code
fragment above shows.

And for the finale, in Wicket 1.3 (I gather you are using 1.2), you
indeed can simply call remove(IBehavior) - attribute modifiers are
behaviors. So then emailLabel.remove(rot) should work fine.

Eelco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: setEnabled(false) on FocusableTextField breaks persistence

2007-08-30 Thread janders
-on-FocusableTextField-breaks-persistence-tf4351731.html#a12419384
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: setEnabled(false) on FocusableTextField breaks persistence

2007-08-30 Thread Eelco Hillenius
 How embarrassing -- I think I'd better keep my day job.  I can't believe that
 I could not grasp that you meant that I should modify rot using
 rot.setEnabled(true or false) depending on the biz logic.


Heh, no problem. Good you got it now.

Eelco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



setEnabled(false) on FocusableTextField breaks persistence

2007-08-29 Thread janders

I posted this on the Databinder forum but no one seems to know of a
work-around so I thought I'd post it here.

Essentially I have a FocusableTextField that gets set by a DropDownChoice.
If the choice is not other then I setEnabled to false and I place the
string value of the DropDownChoice into the FocusableTextField. However the
model is not persisted when setEnabled is false.

Here is the code: 

// list of existing emailAddresses
final List emailTypeList =
Arrays.asList(EmailAddress.Type.values());
final ListView emailAddresses = new
PropertyListView(emailAddresses) {
@Override
protected void populateItem(final ListItem item) {
final EmailAddress email = (EmailAddress)
item.getModelObject();
final FocusableTextField emailLabel = new
FocusableTextField(label, page);
if (email.getType() != EmailAddress.Type.OTHER)
emailLabel.setEnabled(false);
item.add(emailLabel);
item.add(new DropDownChoice(type, emailTypeList) {
@Override
protected boolean
wantOnSelectionChangedNotifications() {
return true;
}
@Override
protected void onSelectionChanged(final Object
newSelection) {
if (newSelection == EmailAddress.Type.OTHER) {
emailLabel.setEnabled(true);
emailLabel.requestFocus();
} else {
   
emailLabel.setModelValue(newSelection.toString());
emailLabel.setEnabled(false);
}
}
});
  snip 

In this email example the dropdown choices are home, work, and other.
If user selects home or work I want the value of the FocusableTextField to
be home or work and I do not want the user to be able to edit the field.
That's why I set the field's isEnabled to false. On the other hand, if the
user selects other, then I set isEnabled to true so that the user can edit
the field. This works properly (persists the value) because isEnabled is
true.

Is there a workaround for this problem or can someone recommend a different
approach?

-- 
View this message in context: 
http://www.nabble.com/setEnabled%28false%29-on-FocusableTextField-breaks-persistence-tf4351731.html#a12399840
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: setEnabled(false) on FocusableTextField breaks persistence

2007-08-29 Thread Igor Vaynberg
the entire point of disabling the component is that you do not want it to
process submitted input and update its model. you are looking for readonly
behavior rather then disabled i think. why not just set the readonly
attribute on that field.

-igor


On 8/29/07, janders [EMAIL PROTECTED] wrote:


 I posted this on the Databinder forum but no one seems to know of a
 work-around so I thought I'd post it here.

 Essentially I have a FocusableTextField that gets set by a DropDownChoice.
 If the choice is not other then I setEnabled to false and I place the
 string value of the DropDownChoice into the FocusableTextField. However
 the
 model is not persisted when setEnabled is false.

 Here is the code:

 // list of existing emailAddresses
 final List emailTypeList =
 Arrays.asList(EmailAddress.Type.values());
 final ListView emailAddresses = new
 PropertyListView(emailAddresses) {
 @Override
 protected void populateItem(final ListItem item) {
 final EmailAddress email = (EmailAddress)
 item.getModelObject();
 final FocusableTextField emailLabel = new
 FocusableTextField(label, page);
 if (email.getType() != EmailAddress.Type.OTHER)
 emailLabel.setEnabled(false);
 item.add(emailLabel);
 item.add(new DropDownChoice(type, emailTypeList) {
 @Override
 protected boolean
 wantOnSelectionChangedNotifications() {
 return true;
 }
 @Override
 protected void onSelectionChanged(final Object
 newSelection) {
 if (newSelection == EmailAddress.Type.OTHER) {
 emailLabel.setEnabled(true);
 emailLabel.requestFocus();
 } else {

 emailLabel.setModelValue(newSelection.toString());
 emailLabel.setEnabled(false);
 }
 }
 });
   snip

 In this email example the dropdown choices are home, work, and
 other.
 If user selects home or work I want the value of the FocusableTextField to
 be home or work and I do not want the user to be able to edit the field.
 That's why I set the field's isEnabled to false. On the other hand, if the
 user selects other, then I set isEnabled to true so that the user can edit
 the field. This works properly (persists the value) because isEnabled is
 true.

 Is there a workaround for this problem or can someone recommend a
 different
 approach?

 --
 View this message in context:
 http://www.nabble.com/setEnabled%28false%29-on-FocusableTextField-breaks-persistence-tf4351731.html#a12399840
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: setEnabled(false) on FocusableTextField breaks persistence

2007-08-29 Thread janders

So it sounds like I would use something like:

final AttributeModifier ro = new AttributeModifier(readonly, true, new
Model(readonly)); 
if (email.getType() != EmailAddress.Type.OTHER)
emailLabel.add(ro);

If so, then the question becomes, how would I remove that attribute or reset
emailLabel to editable?




igor.vaynberg wrote:
 
 the entire point of disabling the component is that you do not want it to
 process submitted input and update its model. you are looking for readonly
 behavior rather then disabled i think. why not just set the readonly
 attribute on that field.
 
 -igor
 
 
 On 8/29/07, janders [EMAIL PROTECTED] wrote:


 I posted this on the Databinder forum but no one seems to know of a
 work-around so I thought I'd post it here.

 Essentially I have a FocusableTextField that gets set by a
 DropDownChoice.
 If the choice is not other then I setEnabled to false and I place the
 string value of the DropDownChoice into the FocusableTextField. However
 the
 model is not persisted when setEnabled is false.

 Here is the code:

 // list of existing emailAddresses
 final List emailTypeList =
 Arrays.asList(EmailAddress.Type.values());
 final ListView emailAddresses = new
 PropertyListView(emailAddresses) {
 @Override
 protected void populateItem(final ListItem item) {
 final EmailAddress email = (EmailAddress)
 item.getModelObject();
 final FocusableTextField emailLabel = new
 FocusableTextField(label, page);
 if (email.getType() != EmailAddress.Type.OTHER)
 emailLabel.setEnabled(false);
 item.add(emailLabel);
 item.add(new DropDownChoice(type, emailTypeList) {
 @Override
 protected boolean
 wantOnSelectionChangedNotifications() {
 return true;
 }
 @Override
 protected void onSelectionChanged(final Object
 newSelection) {
 if (newSelection == EmailAddress.Type.OTHER)
 {
 emailLabel.setEnabled(true);
 emailLabel.requestFocus();
 } else {

 emailLabel.setModelValue(newSelection.toString());
 emailLabel.setEnabled(false);
 }
 }
 });
   snip

 In this email example the dropdown choices are home, work, and
 other.
 If user selects home or work I want the value of the FocusableTextField
 to
 be home or work and I do not want the user to be able to edit the field.
 That's why I set the field's isEnabled to false. On the other hand, if
 the
 user selects other, then I set isEnabled to true so that the user can
 edit
 the field. This works properly (persists the value) because isEnabled is
 true.

 Is there a workaround for this problem or can someone recommend a
 different
 approach?

 --
 View this message in context:
 http://www.nabble.com/setEnabled%28false%29-on-FocusableTextField-breaks-persistence-tf4351731.html#a12399840
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 

-- 
View this message in context: 
http://www.nabble.com/setEnabled%28false%29-on-FocusableTextField-breaks-persistence-tf4351731.html#a12400575
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: setEnabled(false) on FocusableTextField breaks persistence

2007-08-29 Thread Igor Vaynberg
create a dynamic model instead of new Model(readonly)

-igor


On 8/29/07, janders [EMAIL PROTECTED] wrote:


 So it sounds like I would use something like:

 final AttributeModifier ro = new AttributeModifier(readonly, true, new
 Model(readonly));
 if (email.getType() != EmailAddress.Type.OTHER)
 emailLabel.add(ro);

 If so, then the question becomes, how would I remove that attribute or
 reset
 emailLabel to editable?




 igor.vaynberg wrote:
 
  the entire point of disabling the component is that you do not want it
 to
  process submitted input and update its model. you are looking for
 readonly
  behavior rather then disabled i think. why not just set the readonly
  attribute on that field.
 
  -igor
 
 
  On 8/29/07, janders [EMAIL PROTECTED] wrote:
 
 
  I posted this on the Databinder forum but no one seems to know of a
  work-around so I thought I'd post it here.
 
  Essentially I have a FocusableTextField that gets set by a
  DropDownChoice.
  If the choice is not other then I setEnabled to false and I place the
  string value of the DropDownChoice into the FocusableTextField. However
  the
  model is not persisted when setEnabled is false.
 
  Here is the code:
 
  // list of existing emailAddresses
  final List emailTypeList =
  Arrays.asList(EmailAddress.Type.values());
  final ListView emailAddresses = new
  PropertyListView(emailAddresses) {
  @Override
  protected void populateItem(final ListItem item) {
  final EmailAddress email = (EmailAddress)
  item.getModelObject();
  final FocusableTextField emailLabel = new
  FocusableTextField(label, page);
  if (email.getType() != EmailAddress.Type.OTHER)
  emailLabel.setEnabled(false);
  item.add(emailLabel);
  item.add(new DropDownChoice(type, emailTypeList)
 {
  @Override
  protected boolean
  wantOnSelectionChangedNotifications() {
  return true;
  }
  @Override
  protected void onSelectionChanged(final Object
  newSelection) {
  if (newSelection == EmailAddress.Type.OTHER
 )
  {
  emailLabel.setEnabled(true);
  emailLabel.requestFocus();
  } else {
 
  emailLabel.setModelValue(newSelection.toString());
  emailLabel.setEnabled(false);
  }
  }
  });
snip
 
  In this email example the dropdown choices are home, work, and
  other.
  If user selects home or work I want the value of the FocusableTextField
  to
  be home or work and I do not want the user to be able to edit the
 field.
  That's why I set the field's isEnabled to false. On the other hand, if
  the
  user selects other, then I set isEnabled to true so that the user can
  edit
  the field. This works properly (persists the value) because isEnabled
 is
  true.
 
  Is there a workaround for this problem or can someone recommend a
  different
  approach?
 
  --
  View this message in context:
 
 http://www.nabble.com/setEnabled%28false%29-on-FocusableTextField-breaks-persistence-tf4351731.html#a12399840
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 

 --
 View this message in context:
 http://www.nabble.com/setEnabled%28false%29-on-FocusableTextField-breaks-persistence-tf4351731.html#a12400575
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: setEnabled(false) on FocusableTextField breaks persistence

2007-08-29 Thread janders

I know how to add the attribute, I just don't know how to later remove it
once added.
- JA


Eelco Hillenius wrote:
 
 So it sounds like I would use something like:

 final AttributeModifier ro = new AttributeModifier(readonly, true, new
 Model(readonly));
 if (email.getType() != EmailAddress.Type.OTHER)
 emailLabel.add(ro);

 If so, then the question becomes, how would I remove that attribute or
 reset
 emailLabel to editable?
 
 Always add the attribute modifier, override isEnabled and let that
 return true if you want to add the attribute, and false if you don't.
 
 Eelco
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/setEnabled%28false%29-on-FocusableTextField-breaks-persistence-tf4351731.html#a12400705
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: setEnabled(false) on FocusableTextField breaks persistence

2007-08-29 Thread Eelco Hillenius
 I know how to add the attribute, I just don't know how to later remove it
 once added.

Like I said, override isEnabled in your attribute modifier. When that
returns false, the attribute won't be added. For normal requests,
where a page is rendered everytime again, it simply doesn't show up.
For ajax request, you'll have to add to the ajaxrequest for
re-rendering and the attribute should disappear as well.

Eelco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: setEnabled(false) on FocusableTextField breaks persistence

2007-08-29 Thread janders

I don't understand.  Are you saying that I should use setEnabled(false) or
are you saying that I should use:

  final AttributeModifier rof = new AttributeModifier(readonly, false, new
Model(readonly));

Either way this doesn't seem to work.

- JA



Eelco Hillenius wrote:
 
 I know how to add the attribute, I just don't know how to later remove it
 once added.
 
 Like I said, override isEnabled in your attribute modifier. When that
 returns false, the attribute won't be added. For normal requests,
 where a page is rendered everytime again, it simply doesn't show up.
 For ajax request, you'll have to add to the ajaxrequest for
 re-rendering and the attribute should disappear as well.
 
 Eelco
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/setEnabled%28false%29-on-FocusableTextField-breaks-persistence-tf4351731.html#a12400938
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: setEnabled(false) on FocusableTextField breaks persistence

2007-08-29 Thread Eelco Hillenius
 I don't understand.  Are you saying that I should use setEnabled(false) or
 are you saying that I should use:

   final AttributeModifier rof = new AttributeModifier(readonly, false, new
 Model(readonly));

new AttributeModifier(readonly, true, new Model(readonly) {
  public boolean isEnabled(Component c) {
return shouldTheAttributeBeAdded();
  }
}

and don't add the attribute in your markup.

Eelco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]