Nathan Hook

Ranch Hand
+ Follow
since Jan 10, 2005
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 Nathan Hook

Does anyone happen to know an Eclipse shortcut key for adding Javadoc comments to a Class?

For example I'm hoping to turn the following:



Into:



with a shortcut key in eclipse. Does anything like that exist?

Thank you for your time.
[ June 17, 2008: Message edited by: Nathan Hook ]
Very interesting.

Thank you for the nice response Ulf. Very helpful.
16 years ago
*bump*

Is there anyone with information on this topic? There has got to be someone performing virus scanning in a java based web application.

Thanks for your time.
16 years ago
We are looking for a virus scan product that has a java api.

I've tried searching google and this site and haven't found anything interesting yet.

I've found information about using Norton's command line tool, but that information is from 2004.

http://forum.java.sun.com/thread.jspa?threadID=547560&messageID=2676460

Does anyone know if there are any virus scanning tools made for the java api yet?

Thanks for your time.
16 years ago
My guess on what is happening is that hibernate is getting using the BillingDetails mapping file to persist your object to the database because of the method signature on your method.

public void update(BillingDetails billingDetails)

Try and make a new method that will accept a CreditCard and persist it.

If the same thing happens their might be an issue with your mapping files.

Have you written a unit test to see if you're able to persist a credit card object by itself?


Also, I wouldn't store your business objects in your http session.

I think the following works better.

Request 1.

Get the credit card information from the database by id.
Store that credit card in your http request object.
Get the credit card from the http request in your jsp and display it.
Having a hidden field in your form with the credit card's id.

Request 2

Get the credit card information from the database by the hidden id value.
update that credit card with all the form data.
persist the credit card.

It might seem like a lot of extra work, but we've had a lot of success with this design.

Best of Luck.
To answer your question...

No once the http session is invalidated it will NOT close your hibernate session.

Also, last time I checked the Hibernate team was suggesting using one hibernate session per request. (Not per http session.)

I believe it is called the one hibernate session per request pattern. You should be able to find information about it (the pattern) on hibernates website.

Best of Luck.
Doing a soap request using just a web browser will not work very well.

You can use a program called soapUI to test your web service.

To call your web service from a client application you will need to generate your client code from your web service's WSDL file.

Both version of Axis (1 and 2) have nice documentation on how to generate your client code from a WSDL file.

Best of Luck.
16 years ago
I don't know what the problem is, but I think your URI is not quite right.

Do a search through your post with the value "#id-13753285" and you will see in your WSDL that #-id-13753285 is in a URI. My guess is these value is not correct.

Best of Luck.
16 years ago
I actually like to use a program called soapUI. Very easy to use.
16 years ago
We need to do logical data validation for our published web services and we're not exactly sure where to put this logic.

For example we have a web service that will add new users to our system, but each user must have a unique username. So when adding a new user we must check to see if the new username is available (requiring a database hit). If not, we need to send be an error or a fault.

I was thinking of using an Axis2 Handler for the job, but I don't seem to be able to return an error or a fault inside of the Handlers.

Any friendly help or a push in the right direction is appreciated.
16 years ago
It looks as though your query is not working quite right. I don't see the issue, but do a google search on "COUNT field incorrect or syntax error". Most of the results point toward a query syntax error.

Best of luck.
Hi Kri,

The difference is when and where the data gets cached.

http://www.devx.com/dbzone/Article/29685/

If you look at the above website and under the Hibernate Caching heading there is a nice explanation of First-level vs. Second-level caching.

First-level attaches the cached data to the session.
Second-level attaches the cached data to the session factory.

So, personally I would recommend using Second-level caching (if you're using the session per request hibernate design pattern). However, there is a price to pay with Second-level caching. The data that is cached will never be updated from the database.

Now, there are a few ways around having stale data in your cache.

1.) Restart your application when there is a change.
2.) Don't use hibernate caching and store the data needed in a static class or singlton and have a way to query the database to update that cached data. (I do not know if there is a way to request hibernate to update its Second-level cache at this time. My guess is requesting a new session factory would do the job, but it does take a while to generate a new session factory.)
3.) Don't cache the data. (Are the database hits causing a perceived slow down on your application? Have you run your code through a profiler to see if the database calls are slowing your application down? etc...) It is not always necessary to cache data from lookup tables. I'm sure some people will disagree, but until there is evidence from a profiler for any type of "speed enhancement" I shy away from programming them myself.

Hope this helps.
[ August 30, 2007: Message edited by: Nathan Hook ]
Here some things to do to check to see what is happening.

Print out the hex code of the session for the remote client in both JSPs. For both requests the hex code should be the exact same. (You can often see the hex code of an object by doing a toString().

Check the physical cookie file on the remote client. Really check to see if the jsessionid is being set in that file.

There was something else, but I can't remember it right now.
16 years ago
You will have to determine which type of caching strategy is best for you. We do not know what your system is or what it is doing.

For your second question. There doesn't seem to be any limits set on the number of rows that you can cache.

Link to the Hibernate documentation on Caching:

http://www.hibernate.org/hib_docs/reference/en/html/performance.html

Best of Luck.
I think there is a little bit of a disconnect on how/why to use Hibernate.

Hibernate is used to do Object-Relational Mapping. Meaning that Hibernate will take your object model and then persist that object model to your relational database.

So take the following example:



When we're setting a Country on a User we're actually setting the entire object that we are using to represent a Country on our User.

We are not setting a specific value of that Country's value on the User.

So the database tables would like the following for storing the above classes:



The above are tables that are in a specific normal form. One of the reasons for using relational databases, to reduce the amount of duplicated data.

With what you're doing by placing the name of the country in the User table, is you're lowering your normal form of your database. Which is fine, but what is the purpose of the country table? Its not even being referenced and therefore there isn't any referential integrity.

My guess is you're trying to build something called a FACT table that is easy to query. If that is your case then you will need to rethink how you're using hibernate.