shishir choubey

Greenhorn
+ Follow
since Aug 05, 2008
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 shishir choubey

Hey guys i have found the solution for this

Explanation-
If you create a new object, a new object will be inserted. You need to call EntityManager.find() with the id to get the existing object C. You could also call getReference() to just get a reference to the object, which will not access the database.


Thanks,
Shishir
Hi All,

I am very new to EJB 3.0 and JPA and while implementation i have got one issue.
In the application i have 3 table say A,B & C. B has a FK relationship with PK of A. So functionality is when i update a record in A, a new record with some more details has to be entered in B. So while enter the data in B, i have to check a user entered value in C. To achieve this i am creating a PK Object of the C to get the uniqueness.
Everything is working fine but when i am running the test cases A record is updating in A, a new Record is inserting in B & a New record is also inserted in C.
So in C i dont want to insert the record but it is going and inserting a new record.
I guess somewhere i am wrong to use cascadeType, please help me if anybody has came such scenario.
Code -
--------
POJO for Table A
----------------------
@OneToOne(cascade = CascadeType.REMOVE, mappedBy = "aId")
private B bColumn;

POJO for Table B
------------------------
@JoinColumns( {
@JoinColumn(name = "C_ID", referencedColumnName = "C_ID", nullable = false),
@JoinColumn(name = "B_VALUE", referencedColumnName = "VALUE", nullable = false, insertable = false, updatable = false) })
@ManyToOne
private EnumCTable enumCTable;


@JoinColumn(name = "A_ID", referencedColumnName = "A_ID", nullable = false)
@OneToOne(optional = false)
private A aId;


Thanks in Advance,
Shishir



Hi,
the query suggested by you is not working in oracle.
Can somebody suggedt any other way to implement this.

Thanks in advance

Shishir
Hi All,

I have a problem while displaying the List in the jsp.
Say suppose i have 50 records in the DB and i want to display 10-10 records in the jsp with 'Next' and 'Previous' button.
for this scenario i do not want to keep the whole list in the cache. I want to query the DB each time when user click on the 'Next' or 'Previous' Button.

Please someone suggest me, how to achieve this in jsp.