Commit 9a48c133 authored by michael.simon's avatar michael.simon
Browse files

introduce JPA Metamodel

parent b7f77487
......@@ -76,6 +76,118 @@
<artifactId>hibernate-search</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
</exclusions>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<scope>provided</scope>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>provided</scope>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
</exclusions>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<scope>provided</scope>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>provided</scope>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
</exclusions>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<scope>provided</scope>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>provided</scope>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
<optional>false</optional>
</dependency>
</dependencies>
<build>
......
......@@ -21,6 +21,7 @@ import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Join;
import javax.persistence.criteria.JoinType;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
......@@ -28,8 +29,10 @@ import javax.persistence.criteria.Root;
import edu.kit.scc.webreg.dao.GenericSortOrder;
import edu.kit.scc.webreg.dao.RegistryDao;
import edu.kit.scc.webreg.entity.RegistryEntity;
import edu.kit.scc.webreg.entity.RegistryEntity_;
import edu.kit.scc.webreg.entity.RegistryStatus;
import edu.kit.scc.webreg.entity.ServiceEntity;
import edu.kit.scc.webreg.entity.ServiceEntity_;
import edu.kit.scc.webreg.entity.UserEntity;
@Named
......@@ -236,9 +239,15 @@ public class JpaRegistryDao extends JpaBaseDao<RegistryEntity, Long> implements
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<RegistryEntity> criteria = builder.createQuery(RegistryEntity.class);
Root<RegistryEntity> root = criteria.from(RegistryEntity.class);
Join<RegistryEntity, ServiceEntity> serviceJoin = root.join(RegistryEntity_.service);
List<Predicate> predList = new ArrayList<Predicate>();
predList.add(builder.equal(root.get("user"), user));
predList.add(builder.or(
builder.isNull(serviceJoin.get(ServiceEntity_.hidden)),
builder.equal(serviceJoin.get(ServiceEntity_.hidden), false)));
predList.add(builder.equal(root.get(RegistryEntity_.user), user));
for (RegistryStatus s : status)
predList.add(builder.notEqual(root.get("registryStatus"), s));
......
package edu.kit.scc.webreg.entity;
import java.util.Date;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:37.778+0100")
@StaticMetamodel(AbstractBaseEntity.class)
public class AbstractBaseEntity_ {
public static volatile SingularAttribute<AbstractBaseEntity, Long> id;
public static volatile SingularAttribute<AbstractBaseEntity, Date> createdAt;
public static volatile SingularAttribute<AbstractBaseEntity, Date> updatedAt;
public static volatile SingularAttribute<AbstractBaseEntity, Integer> version;
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.CollectionAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:37.938+0100")
@StaticMetamodel(AdminRoleEntity.class)
public class AdminRoleEntity_ {
public static volatile CollectionAttribute<AdminRoleEntity, Object> adminForServices;
public static volatile CollectionAttribute<AdminRoleEntity, Object> hotlineForServices;
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.CollectionAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.048+0100")
@StaticMetamodel(AdminUserEntity.class)
public class AdminUserEntity_ {
public static volatile CollectionAttribute<AdminUserEntity, Object> roles;
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.052+0100")
@StaticMetamodel(AgreementTextEntity.class)
public class AgreementTextEntity_ {
public static volatile SingularAttribute<AgreementTextEntity, Object> policy;
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.058+0100")
@StaticMetamodel(ApplicationConfigEntity.class)
public class ApplicationConfigEntity_ {
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.CollectionAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.062+0100")
@StaticMetamodel(ApproverRoleEntity.class)
public class ApproverRoleEntity_ {
public static volatile CollectionAttribute<ApproverRoleEntity, Object> approverForServices;
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.102+0100")
@StaticMetamodel(AuditAttributeSourceEntity.class)
public class AuditAttributeSourceEntity_ {
public static volatile SingularAttribute<AuditAttributeSourceEntity, Object> asUserAttr;
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.106+0100")
@StaticMetamodel(AuditDetailEntity.class)
public class AuditDetailEntity_ {
public static volatile SingularAttribute<AuditDetailEntity, Object> auditEntry;
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.CollectionAttribute;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.110+0100")
@StaticMetamodel(AuditEntryEntity.class)
public class AuditEntryEntity_ {
public static volatile CollectionAttribute<AuditEntryEntity, Object> auditDetails;
public static volatile SingularAttribute<AuditEntryEntity, Object> parentEntry;
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.115+0100")
@StaticMetamodel(AuditGroupEntity.class)
public class AuditGroupEntity_ {
public static volatile SingularAttribute<AuditGroupEntity, Object> group;
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.118+0100")
@StaticMetamodel(AuditServiceEntity.class)
public class AuditServiceEntity_ {
public static volatile SingularAttribute<AuditServiceEntity, Object> service;
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.121+0100")
@StaticMetamodel(AuditServiceRegisterEntity.class)
public class AuditServiceRegisterEntity_ extends AuditEntryEntity_ {
public static volatile SingularAttribute<AuditServiceRegisterEntity, RegistryEntity> registry;
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.125+0100")
@StaticMetamodel(AuditUserCreateEntity.class)
public class AuditUserCreateEntity_ {
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.130+0100")
@StaticMetamodel(AuditUserEntity.class)
public class AuditUserEntity_ {
public static volatile SingularAttribute<AuditUserEntity, Object> user;
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.139+0100")
@StaticMetamodel(AuditUserUpdateEntity.class)
public class AuditUserUpdateEntity_ {
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.144+0100")
@StaticMetamodel(BusinessRuleEntity.class)
public class BusinessRuleEntity_ {
public static volatile SingularAttribute<BusinessRuleEntity, Object> rulePackage;
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.CollectionAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.149+0100")
@StaticMetamodel(BusinessRulePackageEntity.class)
public class BusinessRulePackageEntity_ {
public static volatile CollectionAttribute<BusinessRulePackageEntity, Object> rules;
}
package edu.kit.scc.webreg.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2015-12-17T10:35:38.153+0100")
@StaticMetamodel(EmailTemplateEntity.class)
public class EmailTemplateEntity_ {
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment