Re: Editing a GUI form using JPA
Joachim Rohde <[email protected]> Tue, 15 Jul 2025 19:00:56 +0200
| Newsgroups | gmane.comp.java.ide.netbeans.user |
|---|---|
| Message-ID | <[email protected]> |
I had the same problem where I had a panel with some comboboxes which
should be populated by values from the database.
I worked around it by extracting the database calls into it's own method
which needed to be called manually after constructing the panel:
Within my TopComponent I construct the offending panel:
PersonPanel personPanel = new PersonPanel();
personPanel.setDb(db); // db is my object to communicate with the
database
personPanel.initCombo(); // init the components that needs data from
the database
And the PersonPanel#initCombo() method contains the stuff that I had
before in the constructor:
public void initCombo() {
List<Person> persons = db.getPersons();
Person[] toArray = persons.toArray(Person[]::new);
comboPerson.setModel(new
javax.swing.DefaultComboBoxModel<>(toArray));
comboPerson.setRenderer(new PersonComboRenderer());
}
Maybe not the most elegant way but it worked for my case.
On 7/9/25 21:10, Ricardo Palomares wrote:
> Hi all,
>
> After a lot of time, I'm trying to come back to Java development. I have
> an Ant-based Java SE project using Swing and EclipseLink JPA 2.1
> originally developed in Java 8 and NetBeans 8.2. I'm now using Java 17
> and NetBeans 25 (I have 26 also installed, but I don't think this has to
> do with 25 vs. 26). On opening a GUI component that invokes an
> EntityManager I get this error:
>
>
>
>
> Other GUI components not involving DB connection (like the main window,
> with a JFrame and a classic dropdown top menu) can be opened and edited
> without any problem.
>
> The project, however, apparently clean and builds OK. I've replaced the
> original EclipseLink JPA 2.1 library in the project for the global
> EclipseLink 2.2.3, but still I keep getting the same error on GUI
> editing. Any hint about where to start to look?
>
> TIA
>
> --
> Ricardo Palomares (RickieES)
> https://github.com/RickieES
> https://sourceforge.net/u/rpalomares/profile
> http://stackoverflow.com/users/1185157/
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists