smitha eliz joshi

Greenhorn
+ Follow
since Aug 30, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 smitha eliz joshi

Poornima Sharma wrote:Hi Smitha,

Nice post. I am still looking for the contents regarding the topics you pointed out:-

DP / Best practices / Deployment / Security

Please let me know if you find something good.



I have also just started preparing for JWS 6, and believe RMH book ch. 22, 23, 24 would be helpful to build a base for these topics.
Once we have some understanding of these topics, then one can google for specific topics & issues or discuss here.
JWS certification Objectives & Oracle suggested training material




Possible Study Material to Read -

Hello Bill,

Thank you for your reply.

Also, I am sorry for posting bad info in above case,
actually, Entity was written by someone else, and Id was @Generated; and since that id is based on combination of diff info, I need to set it in entity.
Once I commented @Gen annotation from Entity id, merge() works good for all entities in the list.

Thanks.
I am putting list of entities,

if I use persist for entire list, I am getting following
java.lang.Exception: javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist:
because entity with same id exists in DB


if I use merge for entire list, I am getting following
java.lang.Exception: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not insert:
ORA-01400: cannot insert NULL into
because entity does not exists


does that mean I would need to check which entity exist & which not
and use appropriate method with entitymanager?


thanks & regards.

lokesh chenta wrote:"Iterating over the entities and saving them into the required HashMap or whatever collection". This seems to be fine and I don't see anything wrong with this approach.
Though I have not tried, the following links to seems to talk about returning a map from the queries...
http://stackoverflow.com/questions/3292597/how-to-get-java-util-map-from-hibernate-query
http://stackoverflow.com/questions/925363/how-to-fetch-hibernate-query-result-as-associative-array-of-list-or-hashmap

Hope that helps..


thanks for your reply...
hi,

I am new to Hibernate and my query is retrieving entities.

Entity has simple string properties.

one of the property is key (id). I need these entities as detached & need to do read only.

I am thinking to put these entities in hashmap & using id property as key in hashmap.

I am thinking to do it in Java (iterate collection of entities & save in hashmap).

I believe this is not correct way & there would be way to get the retrieved collection in hashmap directly.

Can you please suggest key-word to google I should look for to read on this OR any link/example to this case ?

regards.