Thursday, June 30, 2011

To Do List

Currently most of the presentation layer is transferred to JSP with Servlets instead of just plain servlets as it was done previously, in the first version of the project. That gives a clear separation of business logic and interface elements.
Also a registration possibility was added, in the previous version the users could use only the those user names, that were already in the DB. (That was due to Hibernate DB writing problem)

As the project is coming to it's final stage, here is a list of things that still need to be done:

The priority things to be implemented are the following:
- Proper handling of transactions - only Hibernate transactions are to be used and I should switch off the other types in order to prevent conflicts
- User session needs to be transferred from plain http session to a session, supported by a stateful bean
- Documentation of this new version
- General improvements and testing

Wednesday, June 29, 2011

Writing to a DB with Hibernate

Finally I managed to solve that really old problem of writing into database with the Hibernate approach. (see post from 12.02.2011)
Previously I was thinking, that just as reading from a DB it should be working with HQL queries. They didn't work.

Now I know how to do it correctly: there is a safer method in the Hibernate session - saveOrUpdate. It simply writes an instance of a Hibernate-generated database entity class in to the base. And of course it is possible to use transaction for that. 

Monday, June 27, 2011

JNDI and Service Locator pattern

Right now I am in the process of developing a portable and server independent way of data exchange between the layers of architecture and the architectural elements. So far I found the following methods being proposed in literature:

- accessing through plain JNDI
- using Service Locator design pattern (not recommended by for example: http://www.javalobby.org/articles/service-locator/)

Looks like the question of the design patterns and their usage is changing as the newer versions of EJB appear. I will have to spend more time on this issue than was planned earlier.

Updated: 
A little addition about design patterns by Paul Wheaton (2006):
"I think that any pattern being used in an application could/should(/must!) be trumped by the simplest thing that could possibly work."
Looks like I should keep that in mind.

Saturday, June 25, 2011

Achievements

Today I managed to organize the 3 tiers - presentation, business-logic and persistence in jar and war accordingly. Previously I had some issues with Hibernate concerning that and had to store everything, related to Hibernate in war, now this one is solved.
The next issue of the first version I have to take care of is the proper division of the presentation layer between JSP and Servlets.

So far I have studied a several tutorials, but they didn't cover those questions, so I look further.

Sunday, June 19, 2011

EJB 3.1

Currently I am working on the possibility to switch to EJB 3.1 instead of EJB 3.0. It follows the tendency for further simplification, declared by version 3.0. For example it provides the "interfaceless" mode. Now I am studying the issues that might appear for cooperation with Hibernate and other technologies.

What is clear so far: EJB 3.1 naturally cooperates with NetBeans 6.9-7.0 and GlassFish 3.x, which is already good.

Any further discoveries on this question will follow. 

Saturday, June 11, 2011

Time to continue

Now I can see the gap in my schedule and will use it to start working on the project again. A lot needs to be done and there is time only till the 3rd of July.
The To-do list for the project is in the previous post (from February, that is)