Andy Hahn

Ranch Hand
+ Follow
since Aug 31, 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 Andy Hahn

I found out the cause to this issue. It is not the same issue most people are experiencing, according to google. Maybe it will help somebody.

Our named query was returning NULL for a not-null column in a result set. We had to look at the sql hibernate was generating to determine this.

When we ran the sql manually in Sql Developer and sure enough we saw the NULL. This is an Oracle bug and our DBAs have opened a trouble ticket with Oracle.

We are suddenly receiving the following exception in our production app when executing a named query which simply loads a collection of Org objects:

We have the vrsnNbr column defined as not null in the database.

Here is the mapping file:

After googling for many hours I cannot seem to make sense of this exception. Any ideas would be welcomed!

Our DBA noticed some performance issues and ask if Hibernate used bind variables. I thought so but he checked the output from the Oracle logs and it doesnt look like it does, meaning it shows a plain insert into table () values();

If no, is there a way to make hibernate use bind variables on

I try to avoid writing custom tags. I also hate maintaining them. But I see your point. Thanks
13 years ago
Looking for advice. To render my JSPs I am placing objects as request attributes and accessing them that way. Sometimes I need special methods that my pojos (most of which are hibernate) currently dont have. I would rather not add special formatting methods, etc to my pojos. Instead I would like to wrap the pojos with some type of view bean. Is there a recommended pattern for doing this?
13 years ago
Yeah I have used that, but man it can get messy fast. Especially with apache mod configs, and using taglibs to generate localized links (taglibs sometimes append on a session id). I think the easiest approach is to just put static files on a web server rather than embedding in a war/ear file. I hate to say that but its true. A servlet container is probably not the best place to store static content. So maybe thats why an exclude feature is not on the horizon even for the 3.0 servlet spec.
14 years ago
I am aware of the options, but I am intrigued by the servlet filter option. can you elaborate more on how that would work?
14 years ago
Is there a way to exclude files from a servlet-mapping url-pattern in an upcoming servlet spec? This is totally ridiculous if the answer is no.
14 years ago
I got rid of the HibernateCallback stuff and it works now. I don't think I would even need HibernateCallback since my Daos are wrapped by Service classes which are @Transactional.

I ended up also shortening my code to just return sqlQuery.list(). That slimmed down my code several lines.

Thanks for the advice!

For what kind of thing? I not sure if I've *ever* used it, although it's been a year or so.

For working with a SQLQuery object. Since createSQLQuery() is a method on session and not HibernateTemplate. My understanding is that I should to use HibernateCallback any time I work with session directly.

This is largely a matter of preference, but doesn't the list() method normally return an empty list? It just seems like you're making Hibernate *harder* to use, not easier.

Yes but I never liked the fact that Hibernate returns an empty collection - to me its like code that returns an empty String. I guess it just bugs me when code instantiates an unnecessary object. I also have a habit of checking nulls all the time. But I def see your point.

Im not sure why the parameters are not working. Maybe its a Hibernate bug in this particular version. I'll keep looking and let you know if I come up with anything. Thanks for looking.

I'd sure prefer a means of not having to build a map and list before every single query--to me it looks like you've eliminated the fluent query interface Hibernate provides and replaced it with what it was intended to fix.

I think Im stuck using the HibernateCallback for this type of thing, aren't I? How would you do it differently? I'm definitely interested in improving this code and if you can provide an example that would be great.

You also force a null check

You mean the method can return a null so someone would have to do a null check? Isn't that better than returning an empty collection? What's the alternative?

In any case, isn't setFirstResult() 0-based?

Yep I believe so. My example used a 1 for some reason.
Hi, I cant figure this out for the life of me. Any help is appreciated. Using Oracle 11g and Hibernate 3.0.5.

I have the following method in a class named HibernateQueryService:

and I get no results back when I run this code:

The record exists in the table. The query works if hard code the org_id value in the sql instead of using the parameter - "?". Thoughts?
OK thanks. I wanted to avoid using a prefix since masking all of that with rules, etc in mod_jk is a pain and I really want short seo urls coming off of my domain name. I ended up just moving all of my images, css, js, etc to a web server so now I can filter everything using /*.
14 years ago

Is there any way to tell the <url-pattern> to exclude certain items? This question must come up a lot since MVC frameworks love to filter stuff, including css, images, and js scripts! If not, does anyone know if this will be available in a future servlet spec?
14 years ago
I would like to create a secure login using spring security but I would also not like to use HttpSession. Does anyone know a good way of doing this?
14 years ago