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 172095 - Need more control over "Entity Classes from Database"
Summary: Need more control over "Entity Classes from Database"
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-13 00:23 UTC by err
Modified: 2016-07-07 08:55 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description err 2009-09-13 00:23:31 UTC
A note about my use-case and workflow. I'm using "MySQL workbench" to create the ER diagrams. Then run some perl to
transform into derby sql (pretty simple). Then I use "Entity Classes from Database". As I develop and modify the
database, I need to run this process.

This makes it very important that there is very little that I have to do to the generated entity classes.

But the entity classes may need to have the annotations tweaked, for example fetch=[lazy|eager]. So being able to
specify some kind of transformation assist file would be great.

Other issues can probably be handled by extended the classes.
Comment 1 err 2009-09-13 18:47:24 UTC
My current workflow is ER-->Database-->EntityClass. I'm begining to think that the only way this flow will work well is
ER-->EntityClass. So I guess ideally the ER tool need to know about JPA-2.0 requirements.

I've been using MySQL for ER design. It produces an xml file. I wonder if it makes sense to attempt to translate that
xml file into the dbschema file in META-INF, and then let the system convert that to entity classes.

Or if there is some NB internal representation for what's in an entity class that the ER diagram could be converted into.
Comment 2 err 2009-09-13 21:19:38 UTC
> The XML object/relational mapping descriptor serves as both an alternative to 
> and an overriding mechanism for Java language metadata annotations.
> 12.1 Use of the XML Descriptor

I just found this in the JPA-2.0 spec. I think this is what I was looking for, or at least it is a way to tweak the
results of "Entity Classes from Database" without having to edit the entity files (much). Something else to learn...

Now a little support for editing this is always welcome :-) . I guess now I need to start looking for how to let NB know
about the schema so that code completion works.

> 12.3 XML Schema
>     <?xml version="1.0" encoding="UTF-8"?>
>     <!-- Java Persistence API object/relational mapping file schema -->
>     <xsd:schema targetNamespace="http://java.sun.com/xml/ns/persistence/orm"
>     xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>     elementFormDefault="qualified"
>     attributeFormDefault="unqualified"
>     version="2.0">
Comment 3 Martin Balin 2016-07-07 08:55:36 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss