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.
A few things here: 1. In my experiences, it appears if you generate an entity from database schema and choose not to "Include Related Tables", then it will not generate fields that reference other tables. This is occurring on SQL server for me. What should occur is that all columns should be generated and just not mapped as collections but rather their actual column names. For instance, if I have fooId in my Bar table and I don't generate the Foo class at the time, the fooId column is not generated in the Bar table. 2. I have no way to tell NetBeans NOT to do collections on foreign keys. I can uncheck "Include Related Tables" but my table has a constraint on itself (i.e. parent-child) it generates the collection. There should be an option NOT to create relationships. 3. You add a NamedQueries annotation that is empty.
I could reproduce #1, but not #3. Do you always get an empty NamedQueries annotation, or only for certain tables? If the latter, could you please attach the script to create such a table? Thanks.
After thinking about this a bit, I think the behavior you request in #1 doesn't necessarily makes sense for everyone. The wizard would have to provide an option for it, which is too big a change to be made in 6.1. Moreover, it is not a defect really.
For #3, I don't use a script, I use the dialog in NB. As for #1, it is a legitimate issue because what if I just want to reference one table via JPA? I won't get all columns on that table. Agreed it may not be a defect, but it would be nice to get all columns of a table when I reverse engineer its schema. Of course, these aren't huge issues. I built an ant script using Hibernate Tools to solve my problems.
er...what I posted about #3 doesn't really make sense. It does happen for me on all tables in SQL server, but it's hardly an issue, just a note. Ignore #3.
The #1 part of this ticket is causing some real problems for us, and is requiring a lot of hand modification of netbeans generated database entites. If you create a new entity class (not update an existing one), and you only select a single table, it should generate getters and setters for every column in the table, even if that column is a foreign key. Here's an example: I have two tables: employee and state_code_lookup. The employee table has a column in it called "state_cd" that references the state_code_lookup. Right now, if you choose to generate an entity class for the employee table and you choose nothing else in the picklist, it will not generate the column variable for the state_cd. If it's a new entity class, and you only select one table then you're essentially telling the generator to make you a standalone entity object with all of the columns specified in it. Anything else is a bug in my opinion, because otherwise, the resulting entity class isn't usable. In this example, it's not a huge issue to fix by hand, but the developer shouldn't have to. Unfortunately, with our project, some of our tables have not just one foreign key column in them, but dozens.
usually @Column for missed relationships will not represent tables properly, because table relationships is part of a table, but in 7.2 you can choose to generate missed columns on last wizard step. see http://wiki.netbeans.org/NewAndNoteworthyNB72#Generation_options hope it is.