Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetBeans 23: Issue with JSF Pages from Entity Classes - Integration Problems with template for 'JSF Pages From Entity Beans' controller class #7990

Open
mahammad-fathi opened this issue Nov 26, 2024 · 5 comments
Labels
kind:feature A feature request needs:triage Requires attention from one of the committers

Comments

@mahammad-fathi
Copy link

Description

When using the "JSF Pages from Entity Classes" feature in NetBeans 23 with WildFly 24 as the application server, the generated code fails to integrate correctly.
When build code for Application server session bean to generate code like @PersistenceContext private EntityManager em; Instead, it produces the following code @resource private UserTransaction utx = null; Specifically, the annotations and dependencies for resources like @Resource and @EJB are not correct properly set, which causes runtime issues.

Use case/motivation

The generated code should configure the correct CDI bean management according to the application server and correctly configure all required annotations, @PersistenceContext private EntityManager em; @EJB for session beans, For Session Beans, it does not allow integrated transaction management in WildFly 24.

Related issues

No response

Are you willing to submit a pull request?

No

@mahammad-fathi mahammad-fathi added kind:feature A feature request needs:triage Requires attention from one of the committers labels Nov 26, 2024
@matthiasblaesing
Copy link
Contributor

Please retest with RC3/RC4 of NB24, if that does not fix the issue, please provide complete steps to reproduce.

@mahammad-fathi
Copy link
Author

mahammad-fathi commented Nov 27, 2024

After receiving the source code and compiling RC3/RC4 of NB24, the problem still persists.
Ejb management and transactions must be managed by application servers, for example wildfly, and when creating a session bean from the default template, unfortunately, a code is generated that must be managed manually, like this

    @Resource
    private UserTransaction utx = null;
    @PersistenceUnit(unitName = "my_persistence_unit")
    private EntityManagerFactory emf = null;

If this is a mistake and conflicts with the principles of j2ee. By default, the production code should allow the management of session beans by the application server. as follows:

    @PersistenceContext(unitName = "my_persistence_unit")
    private EntityManager em;

The solution to this problem is to change the template when creating beans from the template. For example, when creating a web application with maven and creating jsf page from entity, which causes the creation of JPA bean and CDI bean, the problem can be solved.

@matthiasblaesing
Copy link
Contributor

Is my understanding correct, that you expect automatic transaction handling by using either EJBs or @Transactional CDI beans?

For example, when creating a web application with maven and creating jsf page from entity, which causes the creation of JPA bean and CDI bean, the problem can be solved.

What are the steps to do this?

@mahammad-fathi
Copy link
Author

yes Of course
change the template when creating beans from the template when using the "JSF Pages from Entity Classes"

@matthiasblaesing
Copy link
Contributor

@mahammad-fathi my understanding is, that you managed to create the files as you want. What are the steps to do this? I don't see the template that satisfies your expectations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:feature A feature request needs:triage Requires attention from one of the committers
Projects
None yet
Development

No branches or pull requests

2 participants