Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!

Mark Stein

Ranch Hand
+ Follow
since May 20, 2002
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 Mark Stein

Thanks. I wasn't sure if that [%t] was set at a server level, or some place else... My thinking was someone familar with log4j might know where it came from. But anyplace you think I can get an answer.
9 years ago
Paul, it's not that I don't like the thread name... but on one server I get the threadname-threadID, and on the other I get just the threadName. I need to figure out where I turn on threadID.

Both are using the same log4j.properties with [%t] in the pattern.
9 years ago
I'm using an application that logs via log4j. I have multiple instances of the app running on different solaris boxes (each box running sun app server 8.2). All apps use the same log4j.properties file. My problem is I'm receiving different data in the logs.

More specificially, the %t variable, which should give me the thread id. On one box, I get "[service-j2ee]", while on another one I get "[service-j2ee-3]" (or some other thread number).

I need the box that isn't writing the thread number to write the thread number in the log. Otherwise, I can't debug by tracing things through the logs if multiple users are testing.

Does anyone have any idea where that value is set?

Thanks.
9 years ago
You can try using a session.saveOrUpdate. Since the generator type in the ID isn't "assigned", hibernate should be able to tell if the object is persisted or transient. What it does is look at the id field... if it's empty, it'll assume the object is transient, and do an insert. If it has a value, it'll assume it's a persisted object and do an update.

If the object is no longer in cache, I don't think hibernate will be able to tell if it's dirty or not, so it'll update even if nothing is changed.

Hope that helps.
Thanks... not sure why I never noticed that just saving a source compiles it.
The one thing that's always driven me crazy with Eclipse, is that you're forced to compile the entire project, rather than just a single class. At least, I've never found a way to compile a single class.

Is my observation correct, or is there a work around?
If those are the whole jsp's, I'd guess they're intended to be include files for other pages. You need to track down the pages that use them, to see how they work.
16 years ago
When using hibernate, I found it best to think about my class structure before my database structure. Take a step back, and don't worry about primary and foreign keys (hiberate will do it for you).

Instead, think about your entity classes, and the relationships between them. That'll lead to your relationship mapping, which will lead to your db schema.
Two quick checks you need to make. First, on the server, hit your url using port 8080 (the tomcat default) and see if you can access your page.

Also, apache configured to work with mod_jk? The connection will be listed in apache's httpd.conf file. Also, in the httpd.conf, there should be a mapping that tells apache to hand of to tomcat (usually servlet/* and *.jsp). You need to make sure that the mapping in your web.xml matches something that apache will know to hand off.
16 years ago
It's been a while since I configured and used PJA, but I do remember I configure a line in my webserver startup script to get it to run. One of the parameters included in that line pointed to my font library. Hope that's helpful.
16 years ago
Nevermind... I figured it out. In my Action classess, I get a hibernate SessionFactory from that I stored in the ServletContext. I then pass that SessionFactory to my query classes.
A question on using Hibernate with Struts. In my design, I have my action classes, and I have my query classes (I reuse the queries in different action classes).

I've got the hibernate/struts plugin configured, so that there's only one session factory. My action class is configured properly (tested it without any logic except forwarding in it).

All the examples I've seen have the hibernate session called via Context in the action class. Is there a way to call the hibernate session from my query class (and call the query class in the action class)?

Any code examples (including imports) would be appreciated.
a servlet can do either doPost or doGet. However, when doing doPost, parameters can only be read once, so make sure you assign them to variables in the servlet the first time you access them.
16 years ago
I agree... Professional Hibernate has a lot of promise, but the typos are driving me crazy. Pretty sloppy editing on Wrox's part.
Looking through both, that's sort of what I though of Hibernate Developers Notebook. Professional Hibernate seems to go into more detail on stuff, but I probably won't need all the stuff in includes right away.

I ended up buying both.