Gyula Klinszky

+ Follow
since Jan 20, 2003
Merit badge: grant badges
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 Gyula Klinszky

Hmm, makes sense i guess. Thanks for the replies !
17 years ago
Thanks for the answers.
Yes, I was thinking about using the context.xml before, but shouldnt the site admin who installs the application provide these resources for the application instead of the application builder ? Meaning that the application builder possibly does not need to know the access data to e.g. the DB, just use it like in the example posted using JNDI, and the site admin could specify the installation's exact parameters.
Or is it too warped logic ?
17 years ago
Hrm, no takers ?

I thought it was quite a common scenario, or is it just that the answer is so obvious ?
17 years ago
Hmm, I found the answer, this is (was) a bug in Hibernate, and according to their bug tracking system, it is corrected in version 3.0.
Bug item

Too bad I cannot upgrade current in my project to 3.0

Originally posted by miguel lisboa:
just a guess:

looks like you'r translating from sql...

if you map Person and Phone as a parent/child relatioship your hql will be much simpler

take a look at docs that ship with install - there they have several parent/child examples

hope this helps

Yes, you are right, that the query is closer to SQL than to HQL, I need practice with it
Still, rewriting it did not help:
It seems that my Hibernate (2.1.8) has a bug evaluating queries containing complex aggregates, it creates the right SQL from the HQL statement, but at the same time it expects one more column returned than the actual number of them. Anyone had similar experiences ?
Hi all,

an update to the topic opener: I changed the sum calculation in the query, removing the multiplication ( sum(xpb.netamount) ), and the exception was gone, so the problem is linked to the "complex" sum command using 2 fields multiplication. Is it familiar to anyone ?
Hi people,

I encountered a strange problem while doing a supposedly simple Hibernate query. I defined 3 columns in the HQL, according to the Hibernate debug, the created SQL also contains 3 columns, but at calling query.list() Hibernate throws an exception saying that it is missing one column. Calling query.getReturnTypes revealed that the query expected a 4th column containing an integer. I am stuck, would welcome an ideas, or pointers on the topic

Here is the basic code:

The DB hierarchy is quite simple, a Person can have multiple Phones, and a PhoneBill is a specific phone's cost data for a given period (BillingPeriod object).
Hi people !

I am having difficulties with a supposedly simple task: I have a web application packed into a WAR file, and want to deploy it on our production server. The difficulty is that this application requires resources from the server (e.g. data source), which are defined in the context configuration files (conf/Catalina/... directory).
I could not find a simple way to deploy, and re-deploy the application, because at undeploying the context config file is removed, plus I found no way to specify the context config file at upload, and deploy.
Tried using the Manager application, ant tasks, so far no easy solutions.

Any suggestions, please ? Did I overlook something trivial ?

Thanks in advance:

-Gyula Klinszky
17 years ago

Originally posted by Nicholas Cheung:
I feel the question is defined in 2 levels. The 1st level should be the data type itself. As it is a phone number, it should be composed of numbers and dash. This level aims to check for data type only, because Struts validation framework aims for such pattern matching.

The 2nd level should be the business type validation, which should be done in the business logic. In such sense, why you wanna bind to the frontend checking? Why dont you allow your business logic to check it with DB, and throw something like InvalidPhoneNumberException? So, the ActionDispatcher finally catch this exception, and execute the "fail" path?


Thank you, Nicholas, I got it solved as you suggested.
I was missing the obvious, that on the fail forward path you can link back to the same form jsp, and pass along error messages by using saveErrors() call in the Action.
My bad, seems so obvious now
18 years ago
I seem to remember having this problem. Something was missing from the Struts distribution, maybe the entry for the double validation from the validator-rules.xml ?
Try to check it.
18 years ago

Originally posted by Marc Peabody:
Business Delegate Pattern - read this.

Keep in mind though that if it passes validation it might not still be valid when you try to submit it to the backend. Someone else may have been entering the same number at about the same time. Having a duplicate number might be better to not "validate" until you try to persist the data. That way, you make only one call to the backend and limit the risk of having a value pass validation but then not be valid when it is persisted.

[ November 05, 2004: Message edited by: Marc Peabody ]

Hi, Marc,

I ran through the pattern you recommended. I am using similar technique with DAO, and DAOFactory objects (e.g. persisting the Person object with createPerson(Person), and updatePerson(Person) calls).
You are right about the duplicate validation. What I failed to find so far though is a way to link back to validation, sending ActionError back, and reloading the form with the unsaved data as I already passed the validate() method of the form, and am in the execute() method of the Action.
18 years ago
Using Validator framework with Struts, I ran into this problem:
I have a Phone details page, on which you can do CRUD operations on phones. One of the requirements is that phone number attribute must be unique in the DB.
Now, my question is, how can one do it "properly" ? I mean all sources strongly suggested that the ActionForm (ValidatorForm) object should not have connection to database as the data-view transfer is made by DAO objects. But this'd mean that "bad" data can pass the validation stage, and also it escapes the Struts trap redirecting this bad data to the form itself.
Anyone, any suggestions ?

Thanks in advance,

18 years ago
Thank you, people Adding this to JakartaStrutsLive I can make a start
18 years ago

Still being newbie to Struts I am looking for sample Struts CRUD application(s) demonstrating Struts best practices, preferrably with Validation included. Could anyone point me to some sources available on the internet ?
I am looking for answers on many simple questions, and would rather learn it from samples, than to bother the list with each of them.

Thanks in advance !
18 years ago