bagaria kushal

Greenhorn
+ Follow
since Mar 29, 2011
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by bagaria kushal

If we specify id generation strategy as AUTO, the persistence provider chooses one of the following strategies :-

- Table
-Sequence
-Identity

My question is on what basis or criteria does the persistence provider decides which strategy to be used?
Please explain me what is the difference between method overriding and redefining
12 years ago
Can you please explain why compile time constants can be marked as static inside inner class
12 years ago
Please explain why inner class can't have static variables???
and if the variable is static final then it compiles fine. why?
12 years ago
I hv some more doubts hope you guys wont mind.

String s="hello";
s=s.concat("world");

so how many objects will get create here? "hello", "world","helloworld" or just "hello" and "helloworld"

12 years ago
Thanks Rob for the explanation.

So concatenation using + creates new Object every time even if the string is already present in the pool.


I hv some more doubts hope you guys wont mind.

String s="hello";
s=s.concat("world");

so how many objects will get create here? "hello", "world","helloworld" or just "hello" and "helloworld"

One more thing in the link provided above its written that the string objects are created in the heap only not in the string literal pool. But I jave read that objects get created in the pool.
Please clarify
12 years ago
The thing which I am not getting is if s3 a new reference variable refering to helloworld object on the string literal pool(correct me if wrong) now if I do s4="hello"+"world"
the string becomes helloworld whose object is already present in string literal pool referenced by s3. So s4 should also refer to the object which s3 refers or there is another concept.
12 years ago
So does that means that s3 object is created using new operator???
12 years ago
First of all I am sorry for not putting my full efforts while asking the question and for the not so clear Subject

well my curiousity behind asking these questions were how string objects are maintained in java.

Most of the places i have read that String s="hello" creates a object in the string literal pool but in the link provided above its written that the String s="hello will create object in the heap only.Now if the object gets created in the string literal pool, so refering to the above program "hello" object gets created, referenced by s1. and "world" referenced by s2.
s1+s2 creates a new object "helloworld" so when String s4="hello"+"world"; gets executed,s4 should get referenced to the earlier "helloworld" object(String literal pool concept) so why s3==s4 evaluates to false.
12 years ago




the output was


false
true
false



please explain
12 years ago
String s3="hello"+"world";
String s4="helloworld";
System.out.println(s3==s4);

Please tell me what happens when we concatenat two string literals using + operator.
What will be the output of SOP. If false then why?
How many Objects are getting created here?
are objects created in string literal pool eligible for GC?
is any object created above is eligible for gc?

12 years ago
This will check whether Session already existed for the request or not. If it existed then it will return the already existed Session. If Session is not already existed for this request then this method will return NULL, that means this method says that the request does not have a Session previously
12 years ago
thanks a lot.
That problem is resolved. I used @OrderBy anotation.
I have a query like
from employee emp left join fetch emp.empnm left join fetch emp.xyz where emp.name=something;


where emp.empnm and emp.xyz may return a list of objects.

so emp.empnm and emp.xyz returns me an unordered set. i want it to be ordered.
how can i achieve this???

Hi all,

I have an application in which i establish connection with database using jdbc. My problem is that whenever the database server's ip address gets changed, i have to go into the code and change the ip address. Is there any solution so that i can mention the ip address outside the code like in xml or something?