SpringFramework_3016

Last modified by superadmin on 2018-01-12 20:20

Back to Item Set

<p/>
<!-- START TestItem -->
<p/>
<div class="TestItem">
<div class="TestItemQuestion">3016 Question:\

Having the following <tt>UserRepository</tt> and <tt>OrderController</tt> classes what method should be invoked instead of XXXXXXXXX in <tt>displayOwner()</tt> method to retrieve user by provided id?
{code}
import org.springframework.data.repository.PagingAndSortingRepository;
public interface UserRepository extends PagingAndSortingRepository<User, Long>{
}

@Controller
public class OrderController {
 private UserRepository userRepository;
 @Autowired
 public OrderController(UserRepository userRepository) {
  this.userRepository = userRepository;
 }

 @RequestMapping("/order/{orderId}/owner/{ownerId}")
 public String displayOwner(@PathVariable Long orderId, @PathVariable Long ownerId, Model model) {
  User user = userRepository.XXXXXXXXX(ownerId);
  ...
 }
}
{code}

</div>

Select 1 correct answer(s)!

<p/>
<ol class="MTestItemChoices" type='A'>
<li>

get

</li>
<li>

getById

</li>
<li>

find

</li>
<li>

findOne

</li>
</ol>
<p/>
<div class="TestItemSkill"><!--$skillid>Skill: $skilltitle</div>
<p/>
</div>
<!-- END MTestItem -->
<p/>
<p/>


{{/velocity}}

Tags:
Created by Alina Vasiljeva on 2013-01-16 07:50
    
This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 6.4 - Documentation