I've managed to make some progress with database connectivity, ended up using hikaricp instead

However, I can't workout where the most appropriate place to put the connection pool close call, is there a close or shutdown function I can override so that the connection pool can be closed cleanly. I haven't had any luck in my search so far

Additionally, I keep running into the following error:
    java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already.    Could not load [META-INF/services/org.mariadb.jdbc.plugin.Codec]. The following stack trace is thrown for debugging purposes as well as to
   attempt to terminate the thread which caused the illegal access.

I'm assuming this is a error more to do hikaricp so I'll enquire among their community about it, but if someone has encountered this before feel to volunteer any suggestions or recommended actions. The odd thing is I still seem to be able to send queries to the database from what I can
tell

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

On 27/12/22 8:23 am, Vit Rozkovec wrote:


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 <james.poll...@iinet.net.au> 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 <james.poll...@iinet.net.au>
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 <james.poll...@iinet.net.au>
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

Reply via email to