-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Not getting data just added without refresh
PostPosted: Tue Jan 10, 2012 5:12 pm 
Newbie

Joined: Tue Jan 10, 2012 4:54 pm
Posts: 1
I'm trying to setup some junit tests to verify that the backend matches what was just submitted, but I'm having a hard time actually finding the data that hasn't been commited yet.

In this part, I'm creating a new job and then setting the job parameters
Code:
Job job = new Job();
job.setJobType(jobType);
job.setJobState(jobState);
job.setAccount(account);
session.save(job);

for( String name : parameters.keySet() ) {
    JobParameter jobParameter = new JobParameter();
    jobParameter.setJob(job);
    jobParameter.setName(name);
    jobParameter.setValue(parameters.get(name));
    session.save(jobParameter);
}


So then I want to check the values, without commiting. At first, when I did a job.getJobParameters(), it wouldn't return anything, but then I added a session.refresh(job), and then it worked.

My question is, is there any way to have hibernate be able to identify that it needs to do a refresh itself when a collection has been updated associated to that object? In this case, that Hibernate knows that the JobParameters of the Job have been updated and when the collection is called to refresh?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.