Rachel Swailes

Ranch Hand
+ Follow
since May 18, 2004
Merit badge: grant badges
For More
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 Rachel Swailes

If it's generating the right sql for you then I think I'd be looking at if it's a problem with netbeans. I did a quick search and found this at Stack Overflow.
I set it up to store, retrieve and delete some lectures using the named query annotation that you had pasted above.

When running the code as is I got these errors

Then I changed one of the queries to use Lecture instead of Lectures and got an error on the other named query

and when I changed them both to be Lecture instead of Lectures there was no error.

So in the end the head of Lecture looked like this

Are you able to run your code at all or does the error from Netbeans prevent you from compiling and running it?

Thanks for the offer but I think I'll try further with a simple setup and see what I can find. I've put it together in IntelliJ and it's not showing any error messages so I'm going to try reading and writing some data with the queries and see how far I get.
Hi there

In the Hibernate Annotations documentation it says that you should use the fully qualified path name with the addPackage method. Is "events" the fully qualified name?

Might not be the solution but couldn't hurt to check.

Other questions are - what version of Annotations are you using and are you using this with JBoss?


Have you looked into using Natural-Id's? I haven't used them much myself but they might help in this scenario

Natural Id's in Hibernate Reference
Hmm, I'm interested to find out why this is. I'm busy putting an example together so that I can see what Hibernate does.

At what point do you get the error?
Hi there

That depends on what you need to use it for. Do you need to traverse the structure to insert something in place in the structure or are you traversing the structure for display purposes?

With large datasets you need to use Hibernate carefully because you will run out of memory quickly. The best practise is to use an Iterator or ScrollableResults to load up one object tree at a time and evict the object (and usually flush the session) as soon as you are finished with it.

Another trick is to load only the parts of the Employee that you need for the process. For example, if you need the Employee name and the related Subordinates and Supervisors but not all of the Employee's Addresses or Tasks (for example) then write your query to exclude the items you aren't going to use. This will speed up your processing and help you keep within your memory limits.

Although you mention that you have short lived sessions. Is there a reason for this?

There are ways to get around this too but I'd need more information about what you are going to do with this large set of Employees before I could suggest what would be best in a case with short sessions.

Also, if you post the relationships that you have done by hand I could work out if a criteria or hql query would indeed be simpler than a sqlquery.

Hope that helps,
Hibernate in Action is a great reference.

There is also the documentation at (Hibernate Reference) which is really thorough.
Hi there

I think you're going to want to redo this when you become more familiar with Hibernate. Relationships between objects are useful in Hibernate especially when it comes to writing queries that are more than findById.

The best place to start is either by reading the documentation and examples at (Hibernate Reference) or by reading Hibernate in Action.

And do the examples because that is the best way to see it working properly.

Also, if you've got specific questions when you start putting your relationships back in - just post on the forums.


Hi there

I think that in this case you need to refer to Lecture in your named queries as Lecture because that is the name of the class. You never need to refer to the name of the table anywhere in your code (HQL included) with the exception of the @Table annotation or if you ever do plain sql queries (that is without hibernate).

Try changing your named queries to use the name of the class instead of the name of the table and see if that works.

After some more investigation, it turns out that the classes we were using for the PathParameterFilter stuff must be interfering with the command object on the form. We're using the Carbon Five ParameterizedUrlHandlerMapping. I don't quite know how or why, but I'll be looking into it further to find out so I'll post the answer here when I find out.
Hi there

I've already asked google and come up short. Does anyone know where I can find a list of the reserved words for Spring MVC?

We were working on an annotated controller today and after an afternoon of harassment, it turns out that you can't have a property on the command object with the name of "*threshold*". So I figure it must be a reserved word.

Any help to find out would be greatly appreciated.

Ulf, I agree that this probably isn't the best way to accomplish this. I was just commenting that (while it's not a brilliant way to go about it) it is technically possible.

And I completely agree that Java code in jsp's is a very bad design!
It turns out (much to my amazement) that you can actually have the src parameter of an image tage point off to another jsp.

Have a look at using a jsp to output a binary stream and an example of why you might want to do this.
[ October 14, 2008: Message edited by: Rachel Swailes ]
This is the best reference I've found for Spring MVC annotations: Annotation based controllers
[ October 01, 2008: Message edited by: Rachel Swailes ]