ObjectDB ObjectDB

Question about modification

#1

Hi, I'm student in Web Apps Developing, I'm trying to use your fucking shit program and I am very close to jump from the window of my school.

What's the problem here?

Thank u Sir.

System.out.println("Entidad a modificar: vehículos || coche || persona || trabajador");
            String entidad = menu.nextLine();
            String vehículos = "vehículos";
            String coche= "coche";
            String persona = "persona";
            String trabajador = "trabajador";
            
            String Id = "Id";
            String matrícula = "matrícula";
            String fechaMatriculación = "fechaMatriculación";
            
            if (entidad == vehículos) {
                System.out.println("Campo a modificar:");
                
            } 
            String campo = menu.next();
                if (campo.equals(Id)) {
                    menu.next();
                    System.out.println("Nuevo valor:");
                    int valor = menu.nextInt();
                    em.getTransaction().begin();
                    Query consulta = em.createQuery("UPDATE vehículos"  + "SET " + campo + "=" + valor + "WHERE id = null");
                    int numeroObjetosModificados = consulta.executeUpdate();
                    em.getTransaction().commit();
                } else {
                    System.out.println("Campo a modificar:");
                    String campo1 = menu.next();
                    if (campo1.equals(matrícula)) {
                        System.out.println("Nuevo valor:");
                        String valor = menu.next();
                        em.getTransaction().begin();
                        Query consulta = em.createQuery("UPDATE " + entidad + "SET " + campo1 + "=" + valor + "WHERE id = 1");
                        int numeroObjetosModificados = consulta.executeUpdate();
                        em.getTransaction().commit();
                    } else {
                        System.out.println("Nuevo valor:");
                        String valor = menu.nextLine();
                        em.getTransaction().begin();
                        Query consulta = em.createQuery("UPDATE "  + "SET fechaMatriculación"  + "=" + valor + "WHERE id = 1");
                        int numeroObjetosModificados = consulta.executeUpdate();
                        em.getTransaction().commit();
                    }
                }

edit
delete
#2

If you really want help you must first improve you communication skills:

  1. Throwing a program that doesn't work with the general question "What's the problem here?", without even explaining what you are trying to do, what is not working, are you getting an error message, exception, etc. is not the right way.
  2. In addition, consider using a more polite language.
ObjectDB Support
edit
delete
#3

pls ban this rude guy, we won't people like him in this place

edit
delete
#4

u must be this guy brah

edit
delete
#5

respect, is my cousin

edit
delete
#6

It was a joke my broda, my bad, it's the best program i've ever used. Thank u for your service!

edit
delete

Reply

To post on this website please sign in.