cancel
Showing results for 
Search instead for 
Did you mean: 

Couple of Java EE related questions, CDI, JPA

Former Member
0 Kudos

Hi,

I thought I'd write an article or two about using Vaadin as a UI library for a SAP Hana backed applications. I got something up and running, based on the EJB example that comes with the SDK, but also got couple of questions related to the provided Java EE Web Profile execution environment.

First is about CDI? It'd be awesome helper for Vaadin apps and also other UI frameworks. That would help both injecting the EJB to UI classes and also to write cleaner UI code. Vaadin CDI integration library looks for BeanManager in some cases via JNDI lookup from java:comp/BeanManager. This don't seem to be in SAP Hana Cloud server, although it should be there by the specification. Is there some alternative JNDI location where it could be searched for?

Another question is about JPA provider. I see that you are using EclipseLink, which is my favourite as well 😉 But the question is, is it on purpose added to war files as a normal dependency (and jar file to WEB-INF/lib)? Shouldn't that be provided by the execution environment and have <scope>provided</scope> in the dependency declaration?

I was also struggling to get the local development server setup up and running, but this is probably an issue in my tunnel setup.

cheers,

matti

Accepted Solutions (1)

Accepted Solutions (1)

Vlado
Advisor
Advisor
0 Kudos

Hi Matti,

First of all, sorry for the delayed reply. I did saw your post but was on vacation then, and after that I totally forgot to follow up on it.

Next, thank you for your interest in HCP and especially for your willingness to share and write about using Vaadin on HCP. Being an open PaaS, such kind of articles and blog posts describing the usage of various popular frameworks and libraries are very much appreciated!

So, I did a small test and indeed - java:comp/BeanManager lookup doesn't seem to work. What does work however is simple DI of it, e.g. in a Servlet:


public class MyServlet extends HttpServlet {

     @Inject BeanManager beanMngr;

-- which is pretty much weird. Not sure if that could be an alternative approach for the Vaadin CDI integration? but anyway, I asked a colleague to have a look into this issue.

As to EclipseLink - yes, it is provided by the runtime execution environment and there is no need to be packaged in the war file. I believe the only reason it has <scope>system</scope> in the sample pom.xml is because it's also required for the tests which are also shipped with the samples.

Cheers,

--Vlado

Former Member
0 Kudos

Hi Vlado, thanks for your answer!

Do you have some issue tracker where I could subscribe to get notified if the issue is fixed?

I'd need to create a custom version of Vaadin CDI (or use some less modern method to fetch EJB reference) so I think I'll base my example on Spring (Boot) at this point, but it would be cool to have it also on standard Java EE stack as well.

cheers,

matti

Vlado
Advisor
Advisor
0 Kudos

Hi Matti,

No, there isn't a public issue tracker, community support is provided via this SCN space. We'll post in this thread as soon as there's any update.


it would be cool to have it also on standard Java EE stack as well.

I couldn't agree more!

Cheers,

--Vlado

Former Member
0 Kudos

I finally decided to wrote my example with Java EE, but just without CDI:

https://github.com/mstahv/sap-hana-with-vaadin

I just wrote a helper to get a reference to the EJB injected directly to a servlet and it works fine like that. But ping me when the issue is solved, I'd love to clean up the example a bit with CDI.

I also blogged about it to here at SAP Community Network, but it is still waiting for moderation.

cheers,

matti

Vlado
Advisor
Advisor
0 Kudos

To all interested: The blog post is now published at .

Thanks Matti for the valuable contribution!

PS: Sure, it'd look cleaner with CDI. We'll ping you when we have updates on that.

Former Member
0 Kudos

Hello,

You should be able to use look up with the latest version of the runtime.

Best Regards,

Violeta

Former Member
0 Kudos

Excellent! Just returning from holiday, but I'll try to test this this week.

cheers,

matti

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I just tried HCP Java EE execution environment version 2.66 with latest version of Vaadin CDI and all seems to work perfectly now. Big thanks!

I need to update my example and write a short blog to get user on the right track right from the start.

cheers,

matti

Former Member
0 Kudos

Hi,

I'm glad to hear that.

Regards,

Violeta

Former Member
0 Kudos

Bump.

Does anybody have any idea on any of these questions?

chers,

matti