This week's book giveaway is in the JDBC and Relational Databases forum.
We're giving away four copies of Murach's MySQL and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!

Dejan Mratinkovic

Ranch Hand
+ Follow
since Nov 20, 2008
Merit badge: grant badges
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dejan Mratinkovic


We are about to start new big project, but yet struggle to decide which technologies to use.

We were considering GWT, Vaadin and similar stuff but choose to stay with Spring MVC. But, what is lacking is basic functionality - simple control for simple table with paging and simple calendar.

We have different solutions on couple of project - from display tag, jQ Grid and JMesa but we are not happy with either of this (talking about table and paging).

To enter date or date time is similar scenario, number of different solutions but not making us happy, mostly lots of java script to deal with.

Vaadin gives great representation, but it seems it could produce problems on other places. It might be technology of choice for some pet projects in future.

What is technology of choice? I guess this is something almost all applications have. Problem seems to be trivial, but yet I do not see proper solutions for it.

What do you use? Are you happy with the way it works?

12 years ago

Deepak Pant wrote:What version of Spring are you using ? You have to be at least at spring-2.5.6.SEC02 level.

The versions of relevant packages are the flowing:

12 years ago
My company is considering moving to IBM WAS.

We have couple of applications in Spring ( or Spring + Struts 2).

One particular application has issues starting on WAS. I keep getting error messages:


As far as I have googl/ed, WAS has an issue with error messages, masking proper errors with so I don't have any clue what is wrong. This should be fixed with patch 19, scheduled for September 22.

Application is Spring MVC + Hibernate + Spring Integration + Spring Security. Removing Spring security did not made any changes.

All works fine with Apache Tomcat.

What can be wrong?

If application works fine with Tomcat, why is Websphere complaining?

Where can I look for clues for what is wrong?

Some other applications (Spring + Struts 2) work fine.
12 years ago
Posted the same question on Spring forum, no luck, let's try here.

I am new to Spring MVC.

So far, I have kept session as clean as possible. Spring MVC seems to encourage session usage via @SessionAttributes

But, I couldn't find any docs describing in detail how this annotation actually works. All I have found are posts on forums from people asking similar question.

I got not much information from

What is lifespan of @SessionAttributes?
To me, after couple of tests, it seems like once another controller is started, the one does not have same session attribute like the previous one, all attributes are cleared (only

defined at that class remain in session), regardless of

. For example, user does not go to SAVE option afetr editing object, but goes to another menu option, so

is never called.

Is my observation correct? Is there any official documentation to back it up?

Btw. I am using Spring 3.0.3

13 years ago
Posted on Spring forum, no luck, let's try here.

I have problem exactly the same as stated in discussion in Spring Roo Forum

Problem is this: In my controller, I adjusted code for the methods for creation (using POST) and update (using PUT). Unfortunately spring security seems to do a redirect so the original PUT-request from my update gets turned into a POST-request which in turn leads to the controller not finding a correct request mapping for the update URL (expects PUT, gets POST).

There is jira issue and it should be fixed with wersion #Fix Version/s: 3.0.2.

I am using Spring 3.0.3. I am new to Spring MVC, so I am not sure that my setup is 100% correct.

If someone can just confirm it is working (Spring MVC + Spring Security + Method PUT for update), I will try to find issue on my side.

If someone had similar issue and resolved it, any hints will be appreciated.
13 years ago
I have my own file, placed in the root of my ear file, set up as described here:

On Jboss 4.2.3 ti all works fine. Now I want to migrate application to Jboss 5.1, but seem to be ignored.

Should I initialize log4j somehow, or do anything else? In 4.2.3 all worked out of the box, without me doing anything else except placing the file into the root of application. I have tried to put the same file elsewhere on classpath, but with same result.

I guess almost all enterprise applications have log4j set up somehow. Anyone got it working on 5.1? Is my problem just file placement or could it be something else, ie. initialize/configure Log4j from my code (which I could do, and I am pretty sure it will work, but would like to avoid)?
13 years ago
Issue resolved.

Code is to simple to be wrong, but, yet, I am missing something.

Of course it is. Issue resolved.

Just in case someone else runs to it:
At one point, before the merge method, object fetched from db got version field updated with version from client (stale). Then, JPA on merge compared "live" object version which matched the "client" version and no optimistic lock exception was raised.

These were some leftovers from previous tests, as original code updated some, but not all fields. So, live object was fetched from db and fields were updated (version among them). But, if that is so, exception will not fire.

I would expect lock exception to fire here also, but I guess I was wrong.

Thanks for the link James, it is a good link, I have been using Java Persistence from wikibooks as reference myself.

My code comes down to this (object is filled with data from Struts 2 forms, so it is plain pojo populated with data from screen), and is very simple:

Bottom line, I never get OptimisticLockException.

This code is witin transaction of stateless Ejb

The log I get is:

Code is to simple to be wrong, but, yet, I am missing something.
[quote]I am calling the ejb from client inside the same jee container[/quote]

Your sample code does not look like you do it. I looks like it is standalone program outside of jee container.
I used to work for a company who had own ORM solution, and used Optimistic Lock to handle concurrent updates on Java EE applications, and it worked fine.

JPA has out of the box solution with @Version. Which I can not get to work. I have googled a bit, couldn't find detailed explanation or proper sample to confirm so. I don't see people complaining about it, so I guess it works.

Environment JPA, EJB3, Jboss 5.1, Mysql 5.0.22, <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>, Struts 2

I have object with @Version property long, which gets auto incresed when record is saved.
I do simple thing:
1)Open the same edit page in two browsers. Version field is persisted on web layer
2)Save changed data. Version gets updated.
3)On another browser I save the record again. Data is staled, version number is less the current. I track in debugger and I see stale data with version number less then current get merged with no error.

Shouldn't OptimisticLockException raise?

Is it expected behavior? Or this will work only with attached objects? If so, how to accomplish optimistic lock on Web app?

I have spent more time than intended on google, and find number of sites with same ~two sentences about, "just put @Version and all will work fine" but couldn't find site o book describing it with more details or real life like sample.

I would welcome any link or book title which covers the the topic I have issues with.

Please check , they have lots of easy to use samples.
13 years ago

lalit upadheyay wrote:searched around this but couldn't find satisfactory explanation.

Top rated on Google for both "Phantom read" and "Nonrepeatable read". Explained in detail with simple examples. Is this what you look for or you need further explanations on something?

Jaikiran Pai wrote:Why EJBs for this? Why not simple java classes which do the same?

Because I already have all the code to do some reprocessing and store data to database in ejbs. And because it is easier for users to trigger the action from web page then to start java util from command line of Unix environment.

I agree standalone application could be good solution for this, but there would then be lots of functionality that need to be rewritten.
Using files from file system is not recommended by EJB specification.

But, I have scenario where I need to load number of files into database (ie. export from older software version, etc).

One possible "correct" way of dong it is upload files.

But, it seems easier and more practical to just copy all the files into file system and just pick them up from there. This application will not be clustered. At least, will not be clustered at the time of that process. And, as it is "one time thing", it will probably be carried out by data load team, so issues that can become problem in theory (server died, database died, etc.) are not really issues.

Is there someone with similar request? What would be correct solution for the problem?