Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
alx_java2b_20250412
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
alx_java2b_20250412
Commits
c105cf33
Commit
c105cf33
authored
May 24, 2025
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pierwszy program Hibernat Sklep
parent
2b977e63
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
P1_OdczytajProdukt.java
...ate/src/main/java/sklep/przyklady/P1_OdczytajProdukt.java
+25
-0
No files found.
PC30-Hibernate/src/main/java/sklep/przyklady/P1_OdczytajProdukt.java
0 → 100644
View file @
c105cf33
package
sklep
.
przyklady
;
import
jakarta.persistence.EntityManager
;
import
jakarta.persistence.EntityManagerFactory
;
import
jakarta.persistence.Persistence
;
import
sklep.model.Product
;
public
class
P1_OdczytajProdukt
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"Początek programu"
);
try
(
EntityManagerFactory
emf
=
Persistence
.
createEntityManagerFactory
(
"sklep_pu"
);
EntityManager
em
=
emf
.
createEntityManager
())
{
System
.
out
.
println
(
"Mam em:"
+
em
);
Integer
id
=
1
;
Product
product
=
em
.
find
(
Product
.
class
,
id
);
if
(
product
==
null
)
{
System
.
out
.
println
(
"Brak produktu o id = "
+
id
);
}
else
{
System
.
out
.
println
(
"Mam produkt "
+
product
);
System
.
out
.
println
(
product
.
getProductName
()
+
" za cenę "
+
product
.
getPrice
());
}
}
System
.
out
.
println
(
"Początek programu"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment