glad to hear you resolved it and sorry for late response, I was away during Xmas.
CDI and EJB are two different technologies/specs both of which are part of Java EE. EJB
being the older one (last release 2013), CDI (last release 2017) is now more commonly
They have some similar capabilities (each has its own mechanics for injection and
interception for instance) but many are different as each spec targets different goals.
Since one technology complements the other, they were commonly used together and CDI
integrates with EJB and allows you to use EJB beans "as if they were CDI" (not
the other way around though).
The list of different capabilities could be quite exhausting, so I would probably point
you towards either googling or specification, depending on how deep knowledge you seek.
EJB spec - https://jcp.org/en/jsr/detail?id=345
CDI spec - http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html
Hope this sheds at least some light.
I can of course try to answer your more specific questions, just this one is a bit too
----- Original Message -----
From: "Karen Goh" <karenworld(a)yahoo.com>
To: "Matej Novotny" <manovotn(a)redhat.com>
Sent: Wednesday, January 2, 2019 11:13:16 AM
Subject: Re: [weld-dev] Clarification needed for using WELD CDI
Thank you for your reply but I managed to resolved the issue of getting the
id. It is something fundamental and yet I had no idea where I had gone wrong
till I read a Dzone article about null pointer exception.
I thought using Dependency injection will solve my problem, after trying
things out for so long.
However, I would still be interested to find out how WELD CDI is different
from EJB’s ( I beg your pardon if there isn’t cos I hadn’t the chance touch
on EJB since I left my studies).
I read from Adam Biden’s using Weld CDI with Tomcat so I do not know if cost
savings is the reason.
Hope to hear from you again.
Sent from Yahoo Mail for iPhone
On Wednesday, January 2, 2019, 4:35 PM, Matej Novotny <manovotn(a)redhat.com>
Is your code public on GitHub (or somewhere else)?
It would be easier to try and help you if I could see the code.
From just the description I don't really understand how do you leverage CDI
in your design and which bits work and which don't.
----- Original Message -----
> From: "Karen Goh" <karenworld(a)yahoo.com>
> To: weld-dev(a)lists.jboss.org
> Sent: Monday, December 24, 2018 11:26:38 AM
> Subject: [weld-dev] Clarification needed for using WELD CDI
> I am a beginner in WELD CDI and my purpose of this email is to clarify if
> WELD CDI can be used in this scenario.
> Basically, I started out my web app project using Java, JEE and jsp and DAO
> The thing is I have problem in getting the id of an entity.
> So, my question is how do I use Weld to get the Id and then used it in my
> DAOimpl ?
> I have a insert(Tutor t) method in tutorDAOImpl.
> Once the tutor's data is inserted into MYSQL the id is in as well cos it is
> using Autoincrement.
> So, I'm thinking of how to use Weld to get the tutor Id since I have the
> getter in tutor_id in Tutor class.
> In this DAO design, there is also a Manager or Service class which call the
> tutorDAOImpl's method and it is in turn called by the Controller.
> If Weld CDI can be used in my case, please tell me how to go about
> implementing it.
> Thank you & regards,
> weld-dev mailing list