Ben Thurley

Greenhorn
+ Follow
since Oct 24, 2005
Ben likes ...
jQuery Eclipse IDE Firefox Browser
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ben Thurley

Hi,

I tried this suggestion but it didn't make any difference. I also had this suggestion plus a couple others on the spring source site.
springsource topic

To save clicking the link here's the solution.


I also just noticed that you have a component-scan in your other xml file (probably your x-servlet.xml). You should also know that the tx:annotation-driven ONLY works on beans in the SAME applicationcontext. So if your tx:annotation-driven is in your root context (ContextLoaderListener) and you are scanning your services in your DispatcherServlet there is no transactional stuff going to happen.



Based on this advice I moved the tx:annotation-driven to the root context. This did the trick!

Thanks for taking the time to help.
Ben
13 years ago
Dear ranchers,

I have started a project in my spare time to update my Java skills but I've reached a bit of a road block. I've been really impressed with spring and hibernate but the transactions are proving a bit tricky. For information I am using the annotation based declarative transactions. I keep getting the following exception when I make an HTTP request that tries to use the hibernate session factory.



I must have spent 8-10 hours so far trying to fix this one and I'm really at my wits end. If you google this exception then most of the solutions are either missing @Transactional or missing <tx:annotation-driven /> from the config. I have both of these already so I don't think this is my problem. Other bits of advice just say to read the manual, I have done this and as far as I can see I am doing everything required.

Here are the relevant bits of code.

The spring context XML looks like this:


This is the XML config for the data layer


Here is the service implementation class. The interface is just a straight interface with no annotations.


Here is my DAO implementation. Again the interface is simple with no annotations.


Finally here is my simple entity.


I've had a look in debug and the sessionFactory is there but its transactionManager property is null. I must be missing something but I've checked countless tutorials etc and can't for the life of me find it. Hopefully someone can help me. Looking forward to your suggestions!

Thanks in advance
Ben
13 years ago
I remember someone saying to me a couple of months ago that Java sucked because you can't write a swap function. A bit of googling turned up several explanations but the easiest to understand was at JavaWorld.

I have to say Ive been programming Java for three years and not once have I had to write a swap function.

Hope this helps
Ben
18 years ago
Thanks for the reply Erik

As it happens i'd just stumbled upon a similar solution myself and was about to update this thread.

I use a Filter to intercept *.jsp requests and create a PersistenceManager for this request.



As you can see the Filter stores the PersistenceManager in a static class; PMRegistry. This is adapted from the somewhat lengthy article at TheServerSide



Now whenever I want to access the PersistenceManager I just make the call



This is the best I can come up with. Any comments good or bad would be welcome.
Currently im getting the PersistenceManagerFactory and PersistenceManager in a Filter and adding it to the request object. However, im not sure if this is the best way to set things up? The filter intercepts all requests.

I have two main concerns:

1 Im not sure if this method yields the best performance?

2 What if a POJO needs access to the PersistenceManager? Like a DAO

Looking forward to your responses.
Thanks
First of all hello everyone this is my first post here.

Im an under grad student in my final year studying computing which means im also starting my final year project. Ive come up with an idea but im not sure if ive bit off more than i can chew.

The crux of the idea is a software MP3 player that allows the play speed to be sped up and slowed down. This would be used for DJ'ing with digital music like MP3's.

My strongest programming language is Java but Im open to using other oo languages if it's not possible or too hard in Java. Has anyone got any experience in this sort of thing or know of some useful places to look?

Thanks for reading this.
Ben
18 years ago