I have a requirement, where I need to load the SQL queries for the specific DAO on demand when the request has been made. This will ensure that I am not loading all the objects as I will be loading only the objects which I am going to work with. That is the main idea behind this operation. I am using JPA for back-end which connects to Oracle DB. Whether it will be better to load all the module specific DAO's on-demand using lazy-init="true" in Spring and load the specific SQL queries for those DAO's? In hibernate we are using named queries. Hence, please do suggest me how we can go about this?
Whether it is better to load the DAOImpl and specific SQL for those DAO on demand (lazy-init="true")?If that is the case how we can do it? Please give me some examples on this? Whether we need to configure the named SQL queries in text file or XML? Which one will be better.Also suggest me which will be the best way of handling this? Any ideas are really appreciated.
I am unclear on if this question is a JPA question or a Spring/Hibernate question. If it is the later, you might try asking elsewhere, as this is a TopLink/JPA forum - TopLink is a JPA provider that includes EclipseLink. If it is JPA, you might make your question more clear, as JPA does not allow defining named queries in a text file and defining a query will not return entities from the database. JPA does allow defining queries in orm.xml or though annations on the entities themselves, and in JPA 2.1, you can add named queries in code. And entities are only returned when the query is executed, so you might want to explain a bit more what you are trying to avoid loading.