Skip to content

Commit

Permalink
Cambios
Browse files Browse the repository at this point in the history
  • Loading branch information
sfaci committed Feb 14, 2019
1 parent c1e0744 commit 1016bda
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 1,051 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
bin
.metadata/
.recommenders/
1 change: 0 additions & 1 deletion .recommenders/caches/identified-project-coordinates.json

This file was deleted.

1 change: 0 additions & 1 deletion .recommenders/caches/manual-mappings.json

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Ejercicios Acceso a Datos 2016-2018
Ejercicios Acceso a Datos 2016-2019
===================================

* **Ejercicio1**: Ejercicio 1 del RA 1 (Primer tema de la Wiki)
* **GestionMongoDB**: Aplicación Java de gestión utilizando MongoDB como base de datos
* **holamongo**: Aplicación CRUD Java con MongoDB
* **Pokemon**: Proyecto de gestión de datos (CRUD) utilizando ficheros (HashMap)
* **PokemonSQL**: Proyecto de gestión de datos (CRUD) utilizando JDBC con MySQL 8
* **PruebaConexionSQL**: Proyecto de prueba para conectar con MySQL 8 utilizando el driver JDBC para esa versión
* **concesionario**: Aplicación de gestión de ejemplo para registrar, modificar, eliminar y buscar información, diseñada siguiendo el modelo MVC
* **examenRA1**: Examen del RA1 resuelto
* **holamongo**: Aplicación CRUD Java con MongoDB
* **ligafutbol**: Ejemplo de aplicación que conecta con Base de Datos utilizando MVC
6 changes: 3 additions & 3 deletions ejemplohibernate/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
Expand Down
6 changes: 3 additions & 3 deletions ejemplohibernate/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ public void guardar(Personaje personaje) {
Session sesion = HibernateUtil.getCurrentSession();
sesion.beginTransaction();
sesion.save(personaje);

for (Arma arma : personaje.getArmas()) {
arma.setPersonaje(personaje);
sesion.save(arma);
}
sesion.getTransaction().commit();
sesion.close();
}

public void modificar(Personaje personaje, List<Arma> armas) {
Session sesion = HibernateUtil.getCurrentSession();
sesion.beginTransaction();
personaje.getArmas().clear();
sesion.save(personaje);

for (Arma arma : personaje.getArmas()) {
arma.setPersonaje(personaje);
sesion.save(arma);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,4 @@ public void setPersonaje(Personaje personaje) {
public String toString() {
return nombre;
}

@Override
public boolean equals(Object o) {
if (!(o instanceof Arma))
return false;

Arma arma = (Arma) o;

if (nombre.equals(arma.getNombre()))
return true;

return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import javax.swing.DefaultListModel;
Expand Down Expand Up @@ -67,12 +68,7 @@ private void inicializar() {
}

public List<Arma> getListadoArmas() {
List<Arma> armas = new ArrayList<>();
for (int i = 0; i < modeloLista.size(); i++) {
armas.add(modeloLista.getElementAt(i));
}

return armas;
return Collections.list(modeloLista.elements());
}

public void anadirArmas(List<Arma> armas) {
Expand Down

0 comments on commit 1016bda

Please sign in to comment.