This week's book giveaway is in the Go forum.
We're giving away four copies of Head First Go and have Jay McGavren on-line!
See this thread for details.
Win a copy of Head First Go this week in the Go forum!

Royston Monteiro

Ranch Hand
+ Follow
since Apr 25, 2008
Royston likes ...
Java Linux Spring
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 Royston Monteiro

Harpreet Singh janda wrote:Have you tried to save the object using session.save() method?


I havent tried session.save

I am using spring with hibernate.

These are the logged errors:
Thanks Cameron.
My question is this:
Shouldn't we declare and map all the fields in the backing object(identity and non-identity fields)?
I have declared all the fields in the object that is mapped to the table:


When I try to add a new row to the database, I create a new instance of this class by setting the USER_NAME and USER_MAIL fields to Strings. The field mapped to the identity column gets its default values of 0. Finally, I attempt to add this new row by calling hibernateTemplate.save(object).

Is this the right way to do it?

Please help.



Hi Folks,
The following is my hibernate mapping file:

The following is my Data Class:

When I say:


I get the exception :


Any idea why? I am using derby database.
The hibernate documentation says this about identity of the generator:


Any help would be much appreciated.

Thanks in advance

If you check the API document for java.util.Collection you will see that Serializable is not a superinterface of it



Thanks Paul, that clears it.
Hi Folks,
Referring to Head First EJB, pg 72.
It says

"All collection implementations of the J2SE API are Serializable"



In the same page, it says the values method of HashMap 's return Collections.

"..Map classes like HashMap and Hashtable have a values() method that returns a collection of just the values without the keys. In other words, if you called it on your HashMap, you'd get a Collection of objects.

..a collection that implements the Collection interface. But that isn't enough to to tell you whether the Collection returned by the values() method is Serializable"



I was a little confused about these two set of statements. Since all implementation's of Collection automatically become Serializable by virtue of implementing Collection, shouldn't all collections returned by values() also be guaranteed to be Serializable?
Thanks Suhas.

That solved the problem.
9 years ago
Hi Folks,
The DAO's I use currently, use JDBCTemplate for all SQL operations.
The application requires that a group of SQL updates should be done within a transaction, so that either all of them are committed together or all are rolled back.

I tried this with JDBCTemplate.batchUpdate, but it looks like each update within the batch is atomic, so a failure in one of them doesnt rollback the whole batch.

Please let me know if there is anyway to tweak JDBCTemplate so that we can control the atomicity of the batch.

I have found that org.springframework.transaction.support.TransactionTemplate is one way to manage transactions but I assume there would have to be major changes to include this. Or is it?


9 years ago
Hi Folks,

Any help?

Cheers,
Royston
9 years ago
Hi Folks,
I have a few queries on the lifecycle of the AbstractWizardFormController.

1. Is the onBind() method called before processCancel?
In my controller, from the onBind method, I call a service method that inserts data into a database using a DAO. When I click the cancel button, I expect the processCancel method to be called, taking me to the cancel page, but find that the insert happens with null values.

2. Am I using onBind for the wrong purpose? Where should I call the insert methods ideally. I have a few if tests that use the getCurrentPage method to check the page the onBind is being called from and performing functionality specific to that page.

3. I have looked around the net for information on the life cycle of this controller but haven't found any. All searches seem to end up in the API. Where can we find information about the lifecycle?

Thanks,
Royston
9 years ago
Hi,
How does the encoding afftect the web.xml?
That is one part of web.xml that I have never paid attention to . Could someone please clarify.
9 years ago
Looks like either the web browser has disabled cookies or a cookie by that name hasnt been sent with the response to the client before this JSP was called.

You could confirm this by verifying that you dont get any output while doing the same thing with scripting.
9 years ago
JSP

Venkat Divvela Yesterday 02:33:22 Subject: behaviour of doStartTag of TagSupport

--------------------------------------------------------------------------------

The valid return values for doStartTag() function are SKIP_BODY and EVAL_BODY_INCLUDE. If the function doStartTag is not overriden then default value SKIP_BODY is returned.
view plaincopy to clipboardprint?
# public int doStartTag() throws JspException{
# return 9911;
# }
# public int doStartTag() throws JspException{
# return 9911;
# }
The function doStartTag is overriden and the returned value 9911 is not valid return value. The default behaviour applied only when the function is not overridden.
From the Tomcat 6.x source code it seems that if the return type is not equal to SKIP_BODY then return type is considered as EVAL_BODY_INCLUDE

if the doStarTag returns EVAL_BODY_INCLUDE and if the custom tag has body then body is evalauted once.

view plaincopy to clipboardprint?
<mytag:ClassicTag >Hello</mytag:ClassicTag>
<mytag:ClassicTag >Hello</mytag:ClassicTag>
Hence "hello" is displayed as output



Thanks. That explains it.

Souvik Dasgupta Today 14:22:40 Subject: behaviour of doStartTag of TagSupport

--------------------------------------------------------------------------------

are you using Tomcat 6.x?



Yes, I am using Tomcat 6
Hi,
My CustomTagHandler that extends TagSupport:


The Jsp that calls this:


I am given to understand that by default(when the doStartTag isnt overridden, the behaviour is to skip the Body. Since I am returning neither of teh expected return values, shouldnt the default behaviour kick in? I assume returning an arbitrary return value integer is similar to not overriding the doStart method as far as default behaviou is concerned. On the contrary, I observe the below output:
The output from the Jsp is

which means that the body is evaluated.

Could someone please suggest.