Open mahammad-fathi opened 4 days ago
Please retest with RC3/RC4 of NB24, if that does not fix the issue, please provide complete steps to reproduce.
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.
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?
yes Of course change the template when creating beans from the template when using the "JSF Pages from Entity Classes"
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