I've been working within the Spring MVC and have absolutely no clue what I'm doing. I'm trying to retrieve a list of objects (or records) from a database using entityManager. I have my method that doesn't seem to do anything:
@Override
public List<Module> sortStatus(String status) {
String queryString = "SELECT id, title, description, credit, minimumScore, daysToComplete, status, deleted FROM Module where status='"
+ status + "'";
Query query = entityManager.createQuery(queryString);
return (List<Module>) query.getResultList();
}
I'm trying to return a list of 'Modules' based on that query string but it doesn't appear to be executing. The documentation and solutions I've found regarding this problem are very complicated for my beginner understanding. Any simple explanations as to why nothing happens would be much appreciated.
[edit]: Persistence file:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="trainingDatabase">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>com.oreillyauto.javawebtraining.domain.Module</class>
<class>com.oreillyauto.javawebtraining.domain.TrainingEntry</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.DB2400Dialect" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" />
<property name="hibernate.jdbc.batch_size" value="30" />
<property name="hibernate.max_fetch_depth" value="30" />
</properties>
</persistence-unit>
</persistence>