From manovotn at redhat.com Wed Jan 2 03:35:45 2019 From: manovotn at redhat.com (Matej Novotny) Date: Wed, 2 Jan 2019 03:35:45 -0500 (EST) Subject: [weld-dev] Clarification needed for using WELD CDI In-Reply-To: <353118694.8744993.1545647198977@mail.yahoo.com> References: <353118694.8744993.1545647198977.ref@mail.yahoo.com> <353118694.8744993.1545647198977@mail.yahoo.com> Message-ID: <1071329569.58175304.1546418145233.JavaMail.zimbra@redhat.com> Hello Karen, 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. Regards Matej ----- Original Message ----- > From: "Karen Goh" > To: weld-dev at lists.jboss.org > Sent: Monday, December 24, 2018 11:26:38 AM > Subject: [weld-dev] Clarification needed for using WELD CDI > > Hi, > > 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 > design. > > 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, > Karen > > > _______________________________________________ > weld-dev mailing list > weld-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/weld-dev > From karenworld at yahoo.com Wed Jan 2 05:13:16 2019 From: karenworld at yahoo.com (Karen Goh) Date: Wed, 2 Jan 2019 10:13:16 +0000 (UTC) Subject: [weld-dev] Clarification needed for using WELD CDI In-Reply-To: <1071329569.58175304.1546418145233.JavaMail.zimbra@redhat.com> References: <353118694.8744993.1545647198977.ref@mail.yahoo.com> <353118694.8744993.1545647198977@mail.yahoo.com> <1071329569.58175304.1546418145233.JavaMail.zimbra@redhat.com> Message-ID: <1884822047.11709697.1546423996237@mail.yahoo.com> Hi Matej, 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. Many thanks. Karen Sent from Yahoo Mail for iPhone On Wednesday, January 2, 2019, 4:35 PM, Matej Novotny wrote: Hello Karen, 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. Regards Matej ----- Original Message ----- > From: "Karen Goh" > To: weld-dev at lists.jboss.org > Sent: Monday, December 24, 2018 11:26:38 AM > Subject: [weld-dev] Clarification needed for using WELD CDI > > Hi, > > 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 > design. > > 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, > Karen >? > > _______________________________________________ > weld-dev mailing list > weld-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/weld-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20190102/b3a8dce8/attachment-0001.html From manovotn at redhat.com Wed Jan 2 07:23:09 2019 From: manovotn at redhat.com (Matej Novotny) Date: Wed, 2 Jan 2019 07:23:09 -0500 (EST) Subject: [weld-dev] Clarification needed for using WELD CDI In-Reply-To: <1884822047.11709697.1546423996237@mail.yahoo.com> References: <353118694.8744993.1545647198977.ref@mail.yahoo.com> <353118694.8744993.1545647198977@mail.yahoo.com> <1071329569.58175304.1546418145233.JavaMail.zimbra@redhat.com> <1884822047.11709697.1546423996237@mail.yahoo.com> Message-ID: <1937668945.58500929.1546431789696.JavaMail.zimbra@redhat.com> Hi, 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 used. 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 broad :) Matej ----- Original Message ----- > From: "Karen Goh" > To: "Matej Novotny" > Cc: weld-dev at lists.jboss.org > Sent: Wednesday, January 2, 2019 11:13:16 AM > Subject: Re: [weld-dev] Clarification needed for using WELD CDI > > Hi Matej, > 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. > Many thanks. > Karen > > > > Sent from Yahoo Mail for iPhone > > > On Wednesday, January 2, 2019, 4:35 PM, Matej Novotny > wrote: > > Hello Karen, > > 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. > > Regards > Matej > > ----- Original Message ----- > > From: "Karen Goh" > > To: weld-dev at lists.jboss.org > > Sent: Monday, December 24, 2018 11:26:38 AM > > Subject: [weld-dev] Clarification needed for using WELD CDI > > > > Hi, > > > > 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 > > design. > > > > 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, > > Karen > >? > > > > _______________________________________________ > > weld-dev mailing list > > weld-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/weld-dev > > > > > > From ljnelson at gmail.com Fri Jan 11 18:00:06 2019 From: ljnelson at gmail.com (Laird Nelson) Date: Fri, 11 Jan 2019 15:00:06 -0800 Subject: [weld-dev] BeanManager#getBeans question Message-ID: Before I file an issue I want to make sure I'm not mistaken in my assumption of what should happen. Suppose I have a set of qualifiers consisting of Any.Literal.INSTANCE and Default.Literal.INSTANCE. Suppose there are two beans in the CDI container of type Foo. Neither is annotated with @Default or @Any. Suppose that during startup I call beanManager.getBeans(Foo.class, setOfQualifiersAsDefinedAbove). I'm observing that in such a case I get a returned Set that has one of the two Foo beans, not both of them. Which one is in the set seems to be random. If instead I call simply beanManager.getBeans(Foo.class) I get both beans. These calls should return equivalent results, yes? Best, Laird -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20190111/58899162/attachment.html From ljnelson at gmail.com Fri Jan 11 19:59:25 2019 From: ljnelson at gmail.com (Laird Nelson) Date: Fri, 11 Jan 2019 16:59:25 -0800 Subject: [weld-dev] BeanManager#getBeans question In-Reply-To: References: Message-ID: On Fri, Jan 11, 2019 at 3:00 PM Laird Nelson wrote: > Before I file an issue I want to make sure I'm not mistaken in my > assumption of what should happen. > I've traced the problem to pilot error (as usual). Sorry for the noise and happy Friday. Best, Laird -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20190111/d98f1d40/attachment.html