java - JPA/Hibernate: code based validation of jpa queries -


What is the correct way to programmatically validate the JPA query in Hibernation based on all the institutions, based on all annotation based questions Validate. But how can I call this validation routine on the programmatic JPA questions to check the errors?

 @Entity Public Square Fu {@Id Public Anti Id; The name of the public string; } 
 main (...) {query q = getEntityManager (). CreateQuery ("Select from E" + foo.class.getName () + "e where e.name = 'x'"); // valid q here} 

Do not check integration check the hell out of your code, a real Schema similar to its production environment by using the database.

Think about it: If you make a wrong type query, then this is an programming bug . What are you going to do with the information? Tell the user that the JPA query is poor? You can actually do all the error log and tell the user "Something bad happened" you will know that when you later check the log, then this is a malformed query ...

< Strong> edit

Also call by making it poor data - Javadoc tells it to throw a hibernate exposure , And I'm not sure what it can do with the string besides being valid ..


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -