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.

Bug 181161 - Support for generating JAXB annotations in entity classes
Summary: Support for generating JAXB annotations in entity classes
Status: RESOLVED FIXED
Alias: None
Product: webservices
Classification: Unclassified
Component: JAXB (show other bugs)
Version: 6.x
Hardware: All All
: P2 normal (vote)
Assignee: Milan Kuchtiak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-24 10:34 UTC by Petr Jiricka
Modified: 2010-08-25 03:28 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Generate JAXB Annotation option (53.62 KB, image/png)
2010-07-21 14:19 UTC, Milan Kuchtiak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Jiricka 2010-02-24 10:34:17 UTC
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.
Comment 1 Petr Jiricka 2010-02-24 10:35:45 UTC
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
Comment 2 David Konecny 2010-02-24 14:38:15 UTC
I would prefer to enhance existing 'REST from Entity Classes' wizard to have an option to generate JAXB annotations directly into JPA classes.
Comment 3 Petr Jiricka 2010-07-14 13:51:32 UTC
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.
Comment 4 Petr Jiricka 2010-07-19 08:12:54 UTC
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.
Comment 5 Milan Kuchtiak 2010-07-21 14:18:19 UTC
Added "Generate JAXB Annotation" checkbox to Entity Classes from DB wizard:
http://hg.netbeans.org/web-main/rev/dca590432f0a

See also the attachment.
Comment 6 Milan Kuchtiak 2010-07-21 14:19:27 UTC
Created attachment 100953 [details]
Generate JAXB Annotation option
Comment 7 Milan Kuchtiak 2010-07-21 14:21:03 UTC
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.
Comment 8 Quality Engineering 2010-07-24 03:38:55 UTC
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
Comment 9 Quality Engineering 2010-08-10 03:12:14 UTC
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
Comment 10 Quality Engineering 2010-08-11 03:13:49 UTC
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
Comment 11 Milan Kuchtiak 2010-08-11 12:56:30 UTC
Implemented completely for REST from Database wizard.
Still not working for REST from Entity wizard.
Comment 12 Quality Engineering 2010-08-12 02:59:16 UTC
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
Comment 13 Milan Kuchtiak 2010-08-23 07:54:27 UTC
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.
Comment 14 Quality Engineering 2010-08-25 03:28:33 UTC
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