Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

chets patel

Ranch Hand
+ Follow
since Apr 27, 2010
chets likes ...
Eclipse IDE Tomcat Server Redhat
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 chets patel

Maintain index of current question being displayed. If currentQuestion index == 1 then do not display Previous button. If currentquestion index == last, then do not display Next button. As Bear Bibeault explained, use JSTL to maintain if condition.
6 years ago
Can you try adding "menuModel" in render attribute of ajax event like below.

6 years ago
Use upper function of sql which convert into upper case. And while passing parameter to query, convert all variables into upper case.

For more reading on hibernate, read my blogpost
I would like to know How inheritance will be used in real world project.
E.g. Consider an example of Bank Account
Approach 1:

When I map these classes with database, using Hibernate using one of the inheritance strategy, e.g. table per sub class, I will end up with three tables. Account, Saving_account and Current_account.
Advantage: I can call operation1() depending on the type of object using polymorphism.
Disadvantage: more tables and classes.

Approach 2:

I need only 1 table for this approach called Account. And "type" field will identify the type of the account.

Advantage: Only 1 table and class.
Disadvantage: I will lose Object oriented world and every place I have to put the condition as below.

As per theory, approach 1 is correct and best. But currently in my project, approach 2 is used. My project is not banking. I took it as an example for the simplicity. Also approach 1 is good for maintaining large complex projects.

Thanks in advance for your inputs.
I know there is big debate going over the net about REST against SOAP. I would like to ask few questions on the top of that.

I am using JAX-WS (SOAP) for quiet few years and It took me no time to learn and it becomes difficult to fit REST on top of SOAP because I could not find a single reason that will convince me that REST is better than SOAP.

People say that REST is easier than SOAP. But according to me, I don't see any learning curve difference between the two.
Suppose I add 1 field in say 10 domain object which is not null, how will I notify my webservice clients if I am using REST. In SOAP generally we publish WSDL. But there is no WSDL here.
How to publish URIs to the client. Let me explain this point in detail.
Say I want to expose cancel order service in REST. My URI is{orderId}. How will my client know that they have to use DELETE and not GET as I have only cancelOrder method and not getOrder method. Also how to publish these different URIs. In SOAP, we publish WSDL. I agree that client need to be recompiled. But publishing the changes to the client is easier in the SOAP. 4. Also people say REST is architecture style. What does this mean?

I am neither against REST nor favouring SOAP. But I am not getting convinced to the extent at which people favour REST. So I think I must be missing some good points of SOAP.

I hope this is not a duplicate question. I tried to search about these specific questions and didn't find answer.
6 years ago
I am trying to learn State design pattern. I took example of Order being placed and having different state. I have implemented it. But I am not sure it is correct way or not. Please check below code and help in that case.

From my client code I will get the context object depending on state.

Please let me know if above implementation is correct?
Thanks in advance.
7 years ago
Hi Jeanne
Thanks for your reply.
I tried catching dataIntegrityViolationException. But issue is, it gives me message that "can not execute JDBCBatchUpdate". If I have unique constraint on more than two columns and I want to display explanatory message to user then it is very difficult for me to do this.
Can you please let me know how can I handle this situation.

Thanks in advance.
I am using spring with JPA (Hibernate Implementation). I want to do mapping of vendor specific SQL error code to my user defined messages. Spring throws DataAccessException. I am not able to retrieve SQL error code from DataAccessException.
I tried somethink like this:

Spring is providing some SQLErrorCodeTranslator using sql-error-code.xml. but it is working with jdbcTemplate. I want to use jpaTemplate.

Thanks in advance.
Hi All,
I am trying to develop new website in spring/hibernate/tomcat/JTOM.
I am just using those jars and not modifying their source code.
Do I need to make my website also open source?
what are the things I have to take care in terms of licensing.
please help
7 years ago
Get result.listIterator() outside while loop both in while condition and in first statement of while loop.
8 years ago
Hi Bill Gorder
Thanks for the quick response.
I have not null check in database for one of the field. If I set for that field as null, then in this scenario, I should get DataAccessException. But still I am getting UnexpectedRollbackException.
But I want to check this as constraint violation exception which is coming under DataAccessException(Checked this in JUNIT using JPATransactionManager).
Can you please let me know how should I handle this.

Thanks in advance.
8 years ago
Hi All,
I am using spring with jboss application server. As per my knowledge spring throws DataAccessException. But when I use it in JBoss, it gives me UnexpectedRollbackException.
I am using JTATransactionmanager for transaction management.

It works fine for JUNIT.

Does any one know the reason?
8 years ago
Hi I want to change the Soap prefix. By default it is taking "env". But I want to change it to soap. I tried below code but it is not working.

It is just adding namespace declaration. but not changing the prefix.
I searched a lot and tried all possible solutions available on net. But not a single solution worked for me.

Thanks in advance.
Please help me. I am stuck.
8 years ago
I have two POJOs as below.

Assuming ID and all other hbm xml mapping works fine as I am able to save and update the objects perfectly fine.
I want to search those companies having particular master comapnies associated with it.
I write below code for searching the company:

When I see the query generated by hibernate, it is as below.

select company0_.COMPANY_ID as COMPANY1_0_, company0_.COMPANY_NAME as COMPANY2_0_, company0_.ADDRESS as ADDRESS0_, company0_.CITY as CITY0_, company0_.DISTRICT as DISTRICT0_, company0_.STATE as STATE0_, company0_.PHONE as PHONE0_, company0_.MOBILE as MOBILE0_, company0_.EMAIL as EMAIL0_, company0_.URL as URL0_, company0_.COUNTRY as COUNTRY0_ from COMPANY company0_ inner join MASTER_CLIENT mastercomp1_ on company0_.COMPANY_ID=mastercomp1_.COMPANY_ID inner join MASTER_COMPANY mastercomp2_ on mastercomp1_.MASTER_COMPANY_ID=mastercomp2_.MASTER_COMPANY_ID where mastercomp2_.MASTER_COMPANY_NAME in (?)

Above query seems ok to me but I get following error.

Caused by: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'company0_.COMPANY_ID=mastercomp1_.COMPANY_ID inner join MASTER_COMPANY mastercomp2_ on mastercomp1_.MASTER_COMPANY_ID=mastercomp2_.MASTER_COMPANY_ID'.

I googled all the examples and they are giving the same query as above.

Can any one please help what is wrong with it.
I wasted whole day but didnt get solution.
No body is there to answer my question
Please help if any one knows the ans