This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Currently, the IDE has a REST from Entity Classes wizard, which generates service and convertor classes that expose a set of entities as a service. However, a cleaner approach would be to generate JAXB annotations directly into JPA classes. This could be done either through a separate wizard as is done now, or by adding this to the JPA from Entity wizard - there could be an option to generate JAXB classes as part of entity generation.
BTW, here is a relevant document which discusses how to map cyclic references to JAXB - a situation that comes up with related JPA entities: https://jaxb.dev.java.net/guide/Mapping_cyclic_references_to_XML.html
I would prefer to enhance existing 'REST from Entity Classes' wizard to have an option to generate JAXB annotations directly into JPA classes.
Milan and I just discussed this - I agree that enhancing the 'REST from Entity Classes' wizard to have this checkbox is needed, but I think there is no harm in allowing the user to generate JAXB annotations also when using the 'Entity from DB' wizard.
Here is an interesting and relevant blog: http://fairitale.blogspot.com/2010/07/glassfish-jpa-jaxb.html It is in the context of SOAP services, though it seems generating JAXB annotations would be relevant to both REST and SOAP scenarios. If the IDE does this right, we could save users a lot of trouble and hand-modifying the sources.
Added "Generate JAXB Annotation" checkbox to Entity Classes from DB wizard: http://hg.netbeans.org/web-main/rev/dca590432f0a See also the attachment.
Created attachment 100953 [details] Generate JAXB Annotation option
The tooltip text says: Useful when entity classes are supposed to represent parameters or return values for Jersey REST services or JAX-WS web service operations.
Integrated into 'main-golden', will be available in build *201007240001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/dca590432f0a User: mkuchtiak@netbeans.org Log: #181161: Generate JAXB Annotations option in entity wizard from database
Integrated into 'main-golden', will be available in build *201008100001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/a0a2f737d48f User: mkuchtiak@netbeans.org Log: #181161: simplify REST from DB wizard similar to EJBFacade wizard
Integrated into 'main-golden', will be available in build *201008110001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/8b2949cc02a4 User: mkuchtiak@netbeans.org Log: #181161: compute primary key types for find method
Implemented completely for REST from Database wizard. Still not working for REST from Entity wizard.
Integrated into 'main-golden', will be available in build *201008120001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/7d8308d07b25 User: mkuchtiak@netbeans.org Log: #181161: generate @XmlTransient annotations for one-to-many relationship
Reported new enhancement for "REST from Entity" wizard in Java EE 6. See the issue 189761. The original feature was implemented, so I am changing the status to FIXED.
Integrated into 'main-golden', will be available in build *201008250001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/cc8d51703095 User: mkuchtiak@netbeans.org Log: #181161: set JAXB on by default