Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Picturerama
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gruppe 12
Picturerama
Commits
6d63c0e1
Commit
6d63c0e1
authored
5 years ago
by
Hermann Owren Elton
Committed by
Olaf Rosendahl
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix connection timeout
parent
dcd268f0
No related branches found
Branches containing commit
No related tags found
2 merge requests
!112
Dev
,
!95
fixed connection timeout
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/App/Database/Hibernate.java
+8
-1
8 additions, 1 deletion
src/main/App/Database/Hibernate.java
src/main/resources/META-INF/persistence.xml
+1
-1
1 addition, 1 deletion
src/main/resources/META-INF/persistence.xml
with
9 additions
and
2 deletions
src/main/App/Database/Hibernate.java
+
8
−
1
View file @
6d63c0e1
...
...
@@ -17,6 +17,8 @@ public class Hibernate {
Persistence
.
createEntityManagerFactory
(
"Database"
,
getProperties
());
private
static
EntityManager
em
=
ENTITY_MANAGER_FACTORY
.
createEntityManager
();
private
Hibernate
(){
throw
new
IllegalStateException
(
"Utility class"
);}
/**
* Sets up the password and username to the database
* @return a map with the password and username
...
...
@@ -238,12 +240,17 @@ public class Hibernate {
}
/**
* Gets entity manager
* Gets entity manager
or makes a new one if the connection is not open anymore
*
* @return the entity manager
*/
public
static
EntityManager
getEm
()
{
if
(!
em
.
isOpen
())
{
em
.
close
();
em
=
ENTITY_MANAGER_FACTORY
.
createEntityManager
();
}
return
em
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/META-INF/persistence.xml
+
1
−
1
View file @
6d63c0e1
...
...
@@ -14,7 +14,7 @@
<property
name=
"hibernate.dialect"
value=
"org.hibernate.dialect.MySQLDialect"
/>
<property
name=
"hibernate.connection.driver_class"
value=
"com.mysql.cj.jdbc.Driver"
/>
<property
name=
"hibernate.connection.url"
value=
"jdbc:mysql://mysql-ait.stud.idi.ntnu.no:3306/olafros"
/>
<property
name=
"hibernate.connection.pool_size"
value=
"
5
"
/>
<property
name=
"hibernate.connection.pool_size"
value=
"
1
"
/>
</properties>
</persistence-unit>
</persistence>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment