Anirban Chowdhury

Ranch Hand
+ Follow
since Aug 05, 2008
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
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anirban Chowdhury

Thanks a lot for that info. Now just to be complete, lets put the compareTo() this way,



Please do suggest if you still see any shortcomings.
7 years ago
Perfect. Thanks a lot. I first find it out and then change the value. Just wanted to confirm one thing, IMO, the compareTo() is never going to compare itself to itself, meaning this would never be equal to otherContact. Isn't that right?
7 years ago
I have a nice problem - **create a phone book** - containing list of contacts.
As a phonebook goes,

1. Contacts are to be always sorted.(by name)
2. Can star mark certain contacts, so they have to be above all the rest.(the * contacts are ordered by the time of contact creation)



Problems faced:

1. The contains doesn't find the entry anymore, what's amiss?
I did try and put an equals and a hashcode on Contact, apparently, if there is a Comparator/Comparable present, the compare* is only invoked.
2. Is it fair to use a TreeSet here, or should any other datastructure be used?
For eg. HashSet and then convert to a TreeSet?
3. The contains() doesn't even compare for all entries in the map, it just compared against C,Ma and Ta entries. Why was that?

Questions priority according to order.
7 years ago
I tried all day today to inject my EJB3 from a serlet. Unfortunately couldn't get it to work.
Weblogic version : 10.3.6


**My EJBs**




**My Servlet**



I have an application.xml and a web.xml but no ejb-jar.xml or other deployment descriptors as I will be using only annotations as of now.

Now, I can do a perfect lookup using the specified JNDI name, however the DI doesn't happen.
I have tried with :@EJB(mappedName="testFirstStatelessBean") as well on the servlet. Even that doesn't work. Please let me know what can be done here?
8 years ago
Manuel, can you point me to some document according to which cascade = all included delete-orphan? AFAIK, it doesn't.
Thanks Anirban.
Hibernate version:3.6.2 final
Personal Oracle Database 11g Release 11.2.0.1.0 - Production

The relationship is like 1 organization can have multiple volunteers. However 1 volunteer may or may not be linked to an organization.
Organization.java

Volunteer.java


organization.hbm.xml

volunteer.hbm.xml




Ok, lets say there is 1 volunteer linked with this organization.
Then if we delink this volunteer from the organization and then call the delete on the organization, shouldn't it just leave an orphan volunteer?
It instead deletes the volunteer as well.



This generates the following SQL:



I think that's incorrect.Could you please suggest?
This was a spring configuration issue and was resolved by adding @SessionAttributes to my Controller class.


Hi All,
I am having a peculiar problem. Every time,I call merge, on the session, Hibernate persists a brand new object. I am using Hibernate 3.6 in a Spring MVC application. I do implement equals and hashcode on the model objects which I try to persist. If I try to debug, the equals() isn't invoked at all. I am really not sure what's going on here.

I am using Spring's OSIVF to open and close sessions and AOP to demarcate transactions

My hibernate.cfg.xml


My employee.hbm.xml

My Model classes



My controller



My service and DAO classes



My AOP configs



The tx. demarcation works correctly , as the new object is persisted successfully, however, after saving the get returns the old object. If I use saveorupdate() instead of merge, it saves a new object,detaches the old object and attaches the new obj. to the session. Can somebody please help me on this?

The answer is on http://forum.springsource.org/showthread.php?126145-Data-commiited-even-after-readonly-true-please-help!!&p=411771&posted=1#post411771

Detailed stack traces are also available. To summarize,

1.Read-only is only an advice and it guarantees nothing, and I would really like the Spring docs to be updated about this.
2.Whenever a query is executed in Oracle using Mybatis, it is in the context of a transaction which is automatically started, committed(or rolled back, if execption is raised),and closed by Mybatis.
3.Logging the application is a good idea and it helped me to find out how the actual transactions are started etc.
8 years ago
Please also provide the service methods. What persistence f/w are you using?
Hi All,
I am currently developing a Spring MVC application.I have configured a JDBC TransactionManager and I am doing declarative transaction management using AOP XML.However, even if I configure the method to run on a read-only=true, it still commits the transaction.

Database : Oracle 10g

My database-config.xml




My controller



How do I prevent the auto commit? I have also noticed that even if I don't put any transaction management code, the code still commits. Please help. Note, the transaction advice is however,invoked as when I put a no-rollback-for for RuntimeException and then do a 1/0, it correctly commits the data and rolls back if I put the same as rollback-for.
I have also tried out the query timeout by putting the thread on sleep, even that doesn't work, but I figure that timeout might be for an actual query, so thats fine.
Please help!!
8 years ago
Hi Tim,
Thanks for the comments. Ok, if I have understood correctly, I would have to configure the port correctly, via Tomcat/Apache so that if I hit abcd.sg it will route to only xx.xxx.xxx.xxx:80 as the site is http. But where / how do I map abcd.sg = xx.xxx.xxx.xxx ?

Thanks & Warm Regards,
Anirban.

PS: I contacted the hosting service providers , and they told me that the IP can be mapped easily via Plesk , which I do not want to be installed as then I have to re-install mySQL and other dependant s.w. Any ideas folks?
9 years ago

Seetharaman Venkatasamy wrote:[not sure]change the port number to 80 from 8080 and then try!



It's not going to work, as I already have an Apache Web Server running on 80, and anyway the IP mapping is not done. It has to be done somewhere , I am sure

9 years ago
Hi Ulf,
Thank you for the response.
1. As of now, only a DNS name has been registered ( abcd.sg). It does not have an IP address mapped to it.
2. I have a Tomcat running @ xx.xxx.xxx.xxx:8080 and if I hit the URL http://xx.xxx.xxx.xxx:8080/webappname , it shows my website.
3. How or rather where do I map the IP to the DNS? Can I do it on my own, or do I have to go back to the DNS registrars for doing it?


Thanks & Warm Regards,
Anirban Chowdhury


9 years ago
Hi Ranchers,
I am running a web application on Tomcat 6.0.32 on CentOS 5 system. I have already got a domain (say abcd.sg) registered . Now, how do I go about mapping the domain to my webapplication. Currently, my webapplication will open up like
http://xx.xxx.xxx.xxx:8080/webappname

I want it to be redirected from abcd.sg..
I have tried the virtual hosting options like below in server.xml, but it did not work out.


Could somebody please light the way a bit!! I googled a lot, but couldn't get a satisfactory answer.

Thanks a lot in advance.
Anirban


Thanks & Regards,
Anirban


9 years ago