NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Netbeans Code Template Help

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
dartmanx



Joined: 02 Feb 2017
Posts: 1

PostPosted: Thu Feb 02, 2017 5:23 pm    Post subject: Netbeans Code Template Help Reply with quote

I am trying to create a Java code template to deal with the obnoxious amount of boilerplate code that JPA Criteria Queries require. This is what I have so far:

Code:
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<${Type}> criteriaQuery = criteriaBuilder.createQuery(${Type}.class);
Root<${Type}> root = criteriaQuery.from(${Type}.class);

TypedQuery<${Type}> query = entityManager.createQuery(criteriaQuery);
List<${Type}> result = query.getResultList();

log.debug("Returned {} results", result.size());



I need to improve it by forcing the import of the various classes. Can anyone help?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo