Is it possible to use deltaspike data module without having a CDIUI application?
I just want to use the power of deltaspike repositories without changing my entire app.
Thx
Is it possible to use deltaspike data module without having a CDIUI application?
I just want to use the power of deltaspike repositories without changing my entire app.
Thx
yes, but you will have to manually fetch the repositories through CDI as @inject won’t work. Obviously, using @CDIUI is much preferred.
Do you have an example? Do you mean using the implementation from deltaspike?
You create the repositories as normal:
@Repository
public abstract class BookingRepository extends
AbstractEntityRepository<Booking, Long> {
but instead of doing this in the UI code:
@Inject
private BookingRepository bookingRepo;
you have to use something like CDI.getCurrent().get(), see here:
http://stackoverflow.com/questions/24798529/how-to-programmatically-inject-a-java-cdi-managed-bean-into-a-local-variable-in
just a word of warning, using that particular method will keep the entities in memory until you destroy them through CDI (they will not be garbage collected automatically).