Skip to content

Commit 9229ff7

Browse files
committed
Added Activity 24 Application - Unit 15
1 parent 0c73ae9 commit 9229ff7

File tree

1 file changed

+31
-0
lines changed
  • Unit15-JPA/src/unit15/jpa/Actividad24_Aplicacion

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package unit15.jpa.Actividad24_Aplicacion;
2+
3+
import unit15.jpa.Actividad22_Aplicacion.Barco;
4+
5+
import java.util.List;
6+
import javax.persistence.EntityManager;
7+
import javax.persistence.EntityManagerFactory;
8+
import javax.persistence.Persistence;
9+
import javax.persistence.Query;
10+
11+
12+
public class Main {
13+
14+
15+
public static void main(String[] args) {
16+
EntityManagerFactory emf
17+
= Persistence.createEntityManagerFactory("barcosMarinerosPU");
18+
EntityManager em = emf.createEntityManager();
19+
20+
String jpql = "SELECT b FROM Barco b WHERE SIZE(b.marineroCollection) >= 5";
21+
22+
Query query = em.createQuery(jpql);
23+
List<Barco> barcos = query.getResultList();
24+
25+
System.out.println("Barcos con 3 o más marineros");
26+
for(Barco b: barcos) {
27+
System.out.println(b);
28+
}
29+
}
30+
}
31+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy