|
11 | 11 |
|
12 | 12 | import org.hibernate.Session;
|
13 | 13 | import org.hibernate.SessionFactory;
|
| 14 | +import org.hibernate.StatelessSession; |
14 | 15 | import org.jboss.jandex.AnnotationTarget.Kind;
|
15 | 16 | import org.jboss.jandex.AnnotationValue;
|
16 | 17 | import org.jboss.jandex.ClassType;
|
@@ -47,6 +48,7 @@ public class HibernateOrmCdiProcessor {
|
47 | 48 | private static final List<DotName> SESSION_FACTORY_EXPOSED_TYPES = Arrays.asList(ClassNames.ENTITY_MANAGER_FACTORY,
|
48 | 49 | ClassNames.SESSION_FACTORY);
|
49 | 50 | private static final List<DotName> SESSION_EXPOSED_TYPES = Arrays.asList(ClassNames.ENTITY_MANAGER, ClassNames.SESSION);
|
| 51 | + private static final List<DotName> STATELESS_SESSION_EXPOSED_TYPES = List.of(ClassNames.STATELESS_SESSION); |
50 | 52 |
|
51 | 53 | private static final Set<DotName> PERSISTENCE_UNIT_EXTENSION_VALID_TYPES = Set.of(
|
52 | 54 | ClassNames.TENANT_RESOLVER,
|
@@ -148,6 +150,15 @@ void generateDataSourceBeans(HibernateOrmRecorder recorder,
|
148 | 150 | .createWith(recorder.sessionSupplier(persistenceUnitName))
|
149 | 151 | .addInjectionPoint(ClassType.create(DotName.createSimple(TransactionSessions.class)))
|
150 | 152 | .done());
|
| 153 | + |
| 154 | + // same for StatelessSession |
| 155 | + syntheticBeanBuildItemBuildProducer |
| 156 | + .produce(createSyntheticBean(persistenceUnitName, |
| 157 | + true, true, |
| 158 | + StatelessSession.class, STATELESS_SESSION_EXPOSED_TYPES, false) |
| 159 | + .createWith(recorder.statelessSessionSupplier(persistenceUnitName)) |
| 160 | + .addInjectionPoint(ClassType.create(DotName.createSimple(TransactionSessions.class))) |
| 161 | + .done()); |
151 | 162 | }
|
152 | 163 | return;
|
153 | 164 | }
|
@@ -179,6 +190,15 @@ void generateDataSourceBeans(HibernateOrmRecorder recorder,
|
179 | 190 | .createWith(recorder.sessionSupplier(persistenceUnitName))
|
180 | 191 | .addInjectionPoint(ClassType.create(DotName.createSimple(TransactionSessions.class)))
|
181 | 192 | .done());
|
| 193 | + |
| 194 | + // same for StatelessSession |
| 195 | + syntheticBeanBuildItemBuildProducer |
| 196 | + .produce(createSyntheticBean(persistenceUnitName, |
| 197 | + true, true, |
| 198 | + StatelessSession.class, STATELESS_SESSION_EXPOSED_TYPES, false) |
| 199 | + .createWith(recorder.statelessSessionSupplier(persistenceUnitName)) |
| 200 | + .addInjectionPoint(ClassType.create(DotName.createSimple(TransactionSessions.class))) |
| 201 | + .done()); |
182 | 202 | }
|
183 | 203 | }
|
184 | 204 | }
|
|
0 commit comments