Skip to main content



      Home
Home » Eclipse Projects » Dali » JPQL Refactoring?(Is there any support for refactoring of JPQL queries?)
icon5.gif  JPQL Refactoring? [message #1046960] Mon, 22 April 2013 11:47 Go to next message
Eclipse UserFriend
Looking into Dali primarily in search for refactoring tools that support JPQL queries.

Is there some way to write a JPQL query to ensure it is updated when types or attributes are renamed (without "updating textual references")?

Writing a regular string that is passed into the query will obviously (?) not work:
return em.createQuery("select c from Company c where c.type = :type", Company.class)
.setParameter("type", type.toString())
.getResultList();

PS: I did have a look at patterns for typesafe JPA queries using the CriteriaQuery API (http://www.ibm.com/developerworks/java/library/j-typesafejpa), but most of us feel that this requires too much extra code to be an attractive option.
Re: JPQL Refactoring? [message #1047008 is a reply to message #1046960] Mon, 22 April 2013 13:07 Go to previous message
Eclipse UserFriend
Using the Criteria API will give you a partial (type level) support, but I wouldn't recommend using it based on this alone.

Dali will currently provide validation to indicate where refactoring has caused errors in NamedQueries defined in JPA metadata (annotations or orm.xml). This will allow you to refactor with less fear of breaking your queries at run-time, as the problems will be identified at design-time. We have an enhancement that is planned for our next release to add refactoring support to NamedQueries. This is on our short list for added refactoring support, so it has higher priority than many other features.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=365950

You could add yourself as a CC to this bug to be alerted of updates.

Neil

Previous Topic:Hibernate to JPA 2.0 migration issues
Next Topic:Headless mode via ant or the like?
Goto Forum:
  


Current Time: Sun Jul 13 00:28:50 EDT 2025

Powered by FUDForum. Page generated in 0.07919 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top