Anand Jain

Greenhorn
+ Follow
since Jul 27, 2009
Merit badge: grant badges
For More
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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anand Jain

I am writing a Java client using apache http client to call a SOAP web service.It accepts a file as an attachment so in java, I need to declare the content type as multipart.

I specified it i Java as below


but I got the below error


Please let me know how to resolve this error. What should be the content type to be specified in Java.
10 years ago

I am using hibernate annotations and for that in the hibernate.cfg.xml i need to add annotated classes like this here p is the package name and Customer is the annotated bean.

Suppose i have 20 such kind of annotated classes, it means I have to write 20 mapping lines for that class.In Spring there is a property packageToScan that can be used to register/load all hibernate annotated classes in the specified package.

Since I am not using Spring, do we have the same functionality in Hibernate?

Also I found one tag in hibernate.cfg.xml at first I thought this will do the job for me, but it didn't work. I didn't get what is the use of this property. Can somebody please let me know about it?
I have a Spring maven project and we are going to use JMock to test service/business/DAO layers of my project as suggested by client.
Can somebody please provide me the good link going through which I can understand and implement it?

I am not clear with the term mock objects. What is the need of mock objects? Why should I use it?Also I have heard of other mocking frameworks like Mockito or EasyMock. Is JMock better than those? or Which one is better to use even? This is just for knowledge sake as I will be using JMock only since it is suggested by the client
11 years ago

Jinal Prakas Shah wrote:It's a simple thing. In the cell table you need to replace that row with another row of textboxes. You need to create the listener on the button click and pass the object of that row to replace the content. I know it's a bit complicated in making you understand here in forum.

Regards


Also, I want to make only the row which will be added on clicking Add button editable. If I have already some rows in the table they shouldn't be edited
11 years ago
GWT

Jinal Prakas Shah wrote:It's a simple thing. In the cell table you need to replace that row with another row of textboxes. You need to create the listener on the button click and pass the object of that row to replace the content. I know it's a bit complicated in making you understand here in forum.

Regards



Can you please provide some sample code?
11 years ago
GWT

I have a cell table in one of my GWT screen. Now requirement is that there will be some button on the screen clicking on which one editable row will be inserted into the cell table. if I am not wrong this is called inline editing.

Can somebody please help me with that? I have just started working in GWT.
11 years ago
GWT
I was reading why do we need to clone an object and this is what I got

We clone an object when initializing an object is too expensive So, instead of creating a new object, we can clone an existing one and only change the properties that matter to our new instance.



I didn't get it properly.Could someone please elaborate it or explain it some other way?
12 years ago

Piyush Mangal wrote:You are already using spring in your project. You can use Spring AOP for exception handling in your code.



Thanks Piyush. Could you please share some sample code or link for using AOP with exception handling.
But is it necessary to catch the exceptions in DAO layer if we use hibernate template?
12 years ago
Hi All,

I am using Spring with Hibernate in my project.
.There are many methods written in DAO implementation java file and every method is using the same try/catch/finally lines of code which seem redundant to me.
I am told to optimize/refactor the code since the file LOC exceeds 10k. I read somewhere that using HibernateDaoSupport we need not to worry about exceptions or closing the session. It will be taken care of by Spring itself. Could somebody please help me how to proceed or do the needful? I am very much new to Spring
I am pasting below code of one method in DAO layer

12 years ago
I have searched this question and found the reply as:

Serialization provides default mechanism for saving an object whereas in Externalization there is no default mechanism and we can control the process and have to override readExternal and writeExternal methods to save an object.

In serialization also we can override readObject and writeObject method to control the process of saving an object so where is the difference between serialization and externalization? Can somebody please throw some light on this?
12 years ago
I am new to web services and below I am sharing my understanding so far by reading on net:

Apache Axis and Apache CXF - are web services frameworks used to develop Java web services.
JAX-RS - Java API to develop Restful web services.
JAX-WS - Java API to develop SOAP web services.

Is the above correct? Or if you want to add something.

Also I have read a term endpoints many time. But still I am not clear with its meaning. Can somebody please explain me?

In my project, I am going to use web services with Spring framework.I am told that project will have both SOAP and RESTful web services.I am very much new to this.
Can somebody please guide me in this regard by sharing some valuable information or any good link which will make me understand better?
12 years ago

Winston Gutkowski wrote:

Anand Jain wrote:I have heard that we should use enums rather than contants. Can somebody please explain me the advantages of using enums over constants?


I think what you may have heard is that you should use enums over primitive constants.

The main reason for this is that an enum constant can't be mistaken for something else, whereas an (eg) int value can. Enums also have several useful structures, such as EnumSet for comparing sets of constants.

HIH

Winston



Hi..Thanks for the reply..do you mean to say enums provide type safety which primitive constants don't provide?
12 years ago
Hi,

I have heard that we should use enums rather than contants. Can somebody please explain me the advantages of using enums over constants?
12 years ago
Hi,

Can somebody please explain the difference among them with example(some sample piece of code) that can really help me understanding the difference.

I searched the difference among them but i couldn't clearly get that may be because of more theory and little example.
12 years ago
What is the difference between Statement and PreparedStatement in JDBC ? Explain it with some example.
When to use either of these?