Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SkuciSe
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tim 2 - 2022
SkuciSe
Commits
4c90b7d7
Commit
4c90b7d7
authored
Sep 15, 2022
by
Mihailo Sebek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
insertZahtev procedura
parent
c4067885
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
SkuciSe/src/main/java/com/example/SkuciSe/model/zahtev/Zahtev.java
+2
-2
SkuciSe/src/main/java/com/example/SkuciSe/repository/ZahtevRepository.java
+11
-2
No files found.
SkuciSe/src/main/java/com/example/SkuciSe/model/zahtev/Zahtev.java
View file @
4c90b7d7
...
@@ -9,8 +9,7 @@ import java.sql.*;
...
@@ -9,8 +9,7 @@ import java.sql.*;
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@ToString
@ToString
public
class
Zahtev
public
class
Zahtev
{
{
int
terminId
;
int
terminId
;
int
korisnikId
;
int
korisnikId
;
int
oglasId
;
int
oglasId
;
...
@@ -18,3 +17,4 @@ public class Zahtev
...
@@ -18,3 +17,4 @@ public class Zahtev
String
vreme
;
String
vreme
;
StanjeZahteva
status
;
StanjeZahteva
status
;
}
}
SkuciSe/src/main/java/com/example/SkuciSe/repository/ZahtevRepository.java
View file @
4c90b7d7
...
@@ -4,6 +4,7 @@ import com.example.SkuciSe.model.zahtev.Zahtev;
...
@@ -4,6 +4,7 @@ import com.example.SkuciSe.model.zahtev.Zahtev;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.sql.CallableStatement
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
@Component
@Component
...
@@ -18,9 +19,17 @@ public class ZahtevRepository {
...
@@ -18,9 +19,17 @@ public class ZahtevRepository {
noviZahtev
.
setVreme
(
vreme
);
noviZahtev
.
setVreme
(
vreme
);
System
.
out
.
println
(
noviZahtev
.
toString
());
System
.
out
.
println
(
noviZahtev
.
toString
());
String
sql
=
"insert into zahtev( oglasid, korisnikid, datum, vreme, stanje) values ("
+
noviZahtev
.
getOglasId
()+
","
+
noviZahtev
.
getKorisnikId
()+
",'"
+
noviZahtev
.
getDatum
()+
"','"
+
noviZahtev
.
getDatum
()+
"','"
+
noviZahtev
.
getStatus
()+
"')"
;
// String sql = "insert into zahtev( oglasid, korisnikid, datum, vreme, stanje) values ("+noviZahtev.getOglasId()+","+noviZahtev.getKorisnikId()+",'"+noviZahtev.getDatum()+"','"+noviZahtev.getDatum()+"','"+noviZahtev.getStatus()+"')";
String
sql
=
"{call insertZahtev(?,?,?,?,?)}"
;
CallableStatement
stmt
=
null
;
try
{
try
{
dataBase
.
statement
.
executeUpdate
(
sql
);
stmt
=
dataBase
.
connection
.
prepareCall
(
sql
);
stmt
.
setInt
(
1
,
noviZahtev
.
getKorisnikId
());
stmt
.
setInt
(
2
,
noviZahtev
.
getOglasId
());
stmt
.
setString
(
3
,
noviZahtev
.
getDatum
());
stmt
.
setString
(
4
,
noviZahtev
.
getVreme
());
stmt
.
setString
(
5
,
noviZahtev
.
getStatus
().
toString
());
stmt
.
executeUpdate
();
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
...
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