Skip to content
Snippets Groups Projects
Commit 3e7fe83b authored by Falucho's avatar Falucho
Browse files

fix

parent ed194c17
No related branches found
No related tags found
No related merge requests found
Pipeline #6614 passed with warnings
......@@ -72,7 +72,21 @@ public class BusinessBean implements BusinessLocal, BusinessRemote {
@Override
public void altaPeriferico(Peripherical p) {
Mechanism peripherical = null;
try {
peripherical = mecanismos.find(p.getName());
} catch (Exception e) {
}
if (peripherical == null) {
mecanismos.create(p);
} else {
if (peripherical instanceof Peripherical) {
p.setId(peripherical.getId());
mecanismos.update(p);
} else {
throw new RuntimeException("Periferico ya registrado con ese nombre");
}
}
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment