BoBi Marley

Greenhorn
+ Follow
since Jan 19, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by BoBi Marley

Hello,

I'm busy developing a Java GUI client/server database application with Netbeans IDE 6.0 and
Mysql to automate the data management and other tasks for my Dongo website
(see http://www.dongo.org to get an idea what is the targeted result of all
my programming). I have a question as described below.

To insert a country in my mysql country table I use the code below which is working fine:

private static void countryInsert(Country country) {
if (country.isValid())
try {
String sqlString = "INSERT INTO country VALUES(0, '" + country.getCode();
sqlString += "', '" + country.getName() + "')";
sqlStatement.executeUpdate(sqlString);
} catch (SQLException ex) {
Logger.getLogger(Objectbase.class.getName()).log(Level.SEVERE, null, ex);
}
}

The first column sid of the country table (as for all my tables) is auto increment:

| sid | bigint(20) unsigned | NO | PRI | NULL | auto_increment |

I would like to get the value assigned to sid by Mysql back into my client Java application
preferably with the one sql statement I'm already using to insert. Only if really necessary
with a second sql statement. What is the best way to programm this?

Thanks and best regards :c),

BoBi
Hi,

Because of different reasons I decided not to continue with the
data bindings provided in the netbeans ide nor the java desktop
database application like it is generated by the netbeans ide. Those
reasons being:
1. Something that should have worked simply did not work.
2. I was not too happy with the provided functionality anyway. Too
much clicks needed to perform the crud operations.
3. The whole construct is to complex, very hard to understand and
maintain and probably new versions will give an unneeded maintenance
problem.
So I will not use the data binding and conceive a solution using
directly the more basic Java components like the Jtable (without
databinding and writing my own tablemodel, ...).

:c), BoBi
16 years ago
Dear Developers,

I'm busy developing a database application with Netbeans IDE 6.0 and Mysql to automate the data management of my Dongo.org project. I have a question as described below.

I've created two projects using "New Project/Java/Java Desktop Application/Database Application" for two different tables in my Mysql database. Since my goal is to have the management screens for the different tables in a tabbed application I enclosed the GUI elements of the first project in a panel and then in a tabbed panel. Furthermore I enclosed the GUI elements of the second project in a panel and copied and pasted this panel into the tabbed panel as a second tab. Since with the copy and paste the binding properties of the second mastertable were lost I reapplied those settings. Also I added code for and modified the buttons actions in the second tab since they referred to the first tab.

The problem I'm having is that for the new button on the second tab it appears not all needed code is executed since visually no new line is added to the mastertable. When debugging the original second project it appears more code is executed than for the second tab (this is code getting attributes of the new instance ...). Nevertheless I have no idea how this code is triggered or called from. Anybody knows how to solve this problem? Which mechanism is not working for my second tab? Maybe it has something to do with the beans binding?

Thanks and best regards :-), BoBi
16 years ago