Download
As a Mapping Database with Write Pojo
Save - Edit - Delete
Configure List - Object - Filtered
How to populate a JTable, JList, JComboBox
How to Change Parameters for the connection to our database
Contact

SAVE - EDIT - DELETE


An overview on how to interact with bailouts, changes, and deletes data.
Here is how quickly thanks to this logic, you can save a given in our DB.

Example:

Utente ut = new Utente();
ut.setNome("Carlo");
ut.setCognome("Rossi");
ut.setIndirizzo("Via piave");
ut.setCitta("Varese");
ut.services.save();

We saved a new user in our DB, and was seen as easy to make a save without worry Connections and Query
.. See me now and what happened.

ogeach table and become a java class, a bean that contains methods that set and get
to store data, it also contains a class method called (services)
sevices method returns an instantiation of the class which extends the object map, ie the table with sql methods
to interact with our DB, the class that contains these methods always ends up as SQL, so in our project
UtenteSQL we will get a class with all methods that can be used sql, so this class will contain,
the method save (); to save a user will contain a delete () method, to delete a user, and will contain an update () method,
change a user. in most other use various methods to contain,
I want to address at this point who will have different needs from standard methods developed, indicate how the above class
to transcribe your own methods, so that will be seen and referred to by several points.

Now we see how to change a user (a record in our db);

we need to modify an object object in question, for if we did not find it in our hands, we can quickly
use the Configuration class, (as I have said several times this class Configuration is used to configure the objects that we need
then a user object)
Now we see how to do

Example:

Utente ut =(Utente)Configuration.configure(Utente.CLASS_NAME,new String[]{Utente.GET_ID},new String[]{"153"});

ut.setIndirizzo("Indirizzo da modificare");

ut.services.update();

as we see it and made a cast with the User Configuration object in configure, we have passed as parameters
1) in the name of the class that we needed, quickly found the class itself, with its static variable class_name,
2) nellarray string we passed in the name of the method to be tested, found more quickly thanks to the variables
of static method names declared in the class, and pass the method name GET_ID,
3) in the other array of strings we pass the value that we should try,
in our case, we indicated to take the user 's id = 153
found the object, we pass to the modification of data, we show the cell to change, in our case will address

ut.setIndirizzo("Indirizzo da modificare");

and modify the address,
Traduzione da Italiano verso Inglese now let us make this change materially with the instance of the services and the method update ();

ut.services.update();

The same applies to the delete method

Example:

Utente ut =(Utente)Configuration.configure(Utente.CLASS_NAME,new String[]{Utente.GET_ID},new String[]{"153"});
ut.services.delete();
And our user will be deleted physically.











contatore