mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-27 21:01:15 +08:00
Add more queryFactory constructors
This commit is contained in:
parent
60c46b1d71
commit
db21ee36e2
@ -37,6 +37,20 @@ public class HibernateQueryFactory implements JPQLQueryFactory {
|
||||
|
||||
private final Provider<Session> session;
|
||||
|
||||
public HibernateQueryFactory(Session session) {
|
||||
this(HQLTemplates.DEFAULT, session);
|
||||
}
|
||||
|
||||
public HibernateQueryFactory(JPQLTemplates templates, final Session session) {
|
||||
this.session = new Provider<Session>() {
|
||||
@Override
|
||||
public Session get() {
|
||||
return session;
|
||||
}
|
||||
};
|
||||
this.templates = templates;
|
||||
}
|
||||
|
||||
public HibernateQueryFactory(Provider<Session> session) {
|
||||
this(HQLTemplates.DEFAULT, session);
|
||||
}
|
||||
|
||||
@ -37,6 +37,26 @@ public class JPAQueryFactory implements JPQLQueryFactory {
|
||||
|
||||
private final Provider<EntityManager> entityManager;
|
||||
|
||||
public JPAQueryFactory(final EntityManager entityManager) {
|
||||
this.entityManager = new Provider<EntityManager>() {
|
||||
@Override
|
||||
public EntityManager get() {
|
||||
return entityManager;
|
||||
}
|
||||
};
|
||||
this.templates = null;
|
||||
}
|
||||
|
||||
public JPAQueryFactory(JPQLTemplates templates, final EntityManager entityManager) {
|
||||
this.entityManager = new Provider<EntityManager>() {
|
||||
@Override
|
||||
public EntityManager get() {
|
||||
return entityManager;
|
||||
}
|
||||
};
|
||||
this.templates = templates;
|
||||
}
|
||||
|
||||
public JPAQueryFactory(Provider<EntityManager> entityManager) {
|
||||
this.entityManager = entityManager;
|
||||
this.templates = null;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user