Sudhanshu Mishra

Ranch Hand
+ Follow
since May 28, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Sudhanshu Mishra

hey all,

I tried finding it out myself and understood that NAN is printed because when first time giveLife is called, there is no 'life' property in Jay, but then
inside giveLife function, it actually gets created.Now since we added 1 to it without giving it any initial value, we got NaN. Now as a side- effect, Jay has a property life with value 'NaN'.prototyping it does not
override it.

Is this understanding correct?
Hi all,

I want to understand the behavior of 'prototype' in JS.
I have written below code:



Output is :

100 :::giveLife::: 61
99 :::takeLife::: 61

However, if I comment out line 16 and uncomment line 20, what I get is below:

100 :::giveLife::: NaN
99 :::takeLife::: NaN

I get the "100 :::giveLife::: NaN" part, but I was expecting "99 :::takeLife::: 61" as I added 'life' for Users to be initialized, via prototype.

Please suggest what I am doing wrong.

Thanks in advance
Hi Ranchers

I am aware that Hibernate uses JDBC API for persistece.
However, I have one query regarding JDBC transactions in Hibernate. I am posting the below snippet and have written what I understand from each line of code:



Could you please verify and correct my understanding, before I study further?

Thanks



Hi Ranchers,

Today I cleared OCEJPA Exam - 1Z0-898 with 83% marks.
First of all a big thanks to all the ranchers who helped me with all my queries while preparation.

I would summarize my method of preparation for this exam, which could benefit others preparing for the exam.

1:Most important - Get the basics right. Be sure of what is guaranteed and what is dependent on the provider.("May be /might be/Must be" kind of stuff).
2:I chose Apress-Pro JPA2 for my preparation and prepared till chapter 13. It is a very good book and gets you familiar with the concepts easily.
3:When in doubt , CODE. Write lots of code snippets to understand the concepts with clarity.
4:Last but not the least, do give a read to JSR-317.It would give you a clear picture of what the Spec says, and the exam questions might have exactly same lines from the spec.
5:Enthuware - Great exam taking tool. This helped me a lot to identify with the exam pattern and my weak/strong areas.

I had a very little experience in JPA. I used to prepare 2-3 hours each day and it took me a month to be ready for the exams.

My Exam Experience:
The questions were a bit difficult and had really close answers.The time, however, was sufficient.
The questions came in a sequential order .i.e. a set of questions from Entity basic mappings, then a set of questions on locking, then a set on Criteria API and so on.
No question on automatic key generation.
Many questions on transactions, Criteria API , locking and caching.

Please let me know if any further information required.
I would be glad to help.

Thanks,
Sudhanshu
Hi ,
Why does a persist method on a removed instance makes it managed , while a merge operation on a removed instance throws an exception.
I am confused as the spec says that a removed instance is still associated with the persistence context.
So why different behavior from persist and merge on a removed entity?
Basic confusion is how to decide when a particular operation will throw an exception.Can we decide it on the basis of an ID conflict , or on the basis of presence of a persistence context?

Thanks
Hi All,
I am a bit confused after reading JSR-317 Section 3.2.8(Managed Instances).

As far as I understand, if an entity is associated with a persistence context, it is managed.
And as per the spec: A managed entity instance is an instance with a persistent identity that is currently associated
with a persistence context.

Then why invoking contains on a removed entity will return false?

Please help me understand the concepts.

Many thanks in advance.
Hi All,
I was going through the JSR-317 and I stumbled across this statement:

Such schema-level mapping annotations must be specified on the owning side of the relationship. Any
overriding of mapping defaults must be consistent with the relationship modeling annotation that is
specified. For example, if a many-to-one relationship mapping is specified, it is not permitted to specify
a unique key constraint on the foreign key for the relationship.



But Many-to-One side IS the owner, then why can it not modify the uniqueness of Foreign Key?

I am new to JPA .Please help me with the basic concepts.

Thanks
HI All,
I am a bit confused regarding the concept of Directionality in JPA.
Why is it important to consider the directionality?
I understand that an entity having a reference to other entity accounts for a direction, but is it all to it?
Do my mapping annotations have any thing to do with directionality, or they simply indicate the cardinality?

Help me get the basics straight.

Thanks in advance.
Thanks for the reply,Rafael de Sousa
If you read the question completly, I also referred that it was mentioned in the Pro JPA 2 book.
Thanks for helping me get this straight though.
Hi all,
Is my question missing any details?
If not, why no answers yet?
Any replies?
I think I have provided the complete details, still if further information required please reply.

HI,
I am learning JPA from book Pro JPA 2- and I have a doubt in the topic - ID Generation using the Table
My doubt is regarding @TableGenerator
When I used


it behaved like AUTO strategy.(Did it happen because I missed the strategy? But no such mention in the book :S)

When I gave the table name as below:

it still behaved like AUTO, even though I have the table this time in my database as

+-----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+-------+
| id_gen | varchar(100) | NO | PRI | | |
| key_value | int(11) | YES | | NULL | |
+-----------+--------------+------+-----+---------+-------+

Please clarify as the behavior is not clear to me.
I came across this while trying to code the examples in the book and when they did not work as expected (Used Hibernate and MySQL) .

Please help me with the problem and let me know if further details required.

Thanks
HI
Does server uses JNDI under the hood to perform a dependency injection of EJBs ?
Please reply.

Thanks,
Sudhanshu