Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
311c4372
Commit
311c4372
authored
Jan 19, 2026
by
Luna Riegel
Browse files
Feat: Create spatial index in embedded database
parent
3cd96976
Changes
2
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/database/EmbeddedDatabaseConfiguration.java
View file @
311c4372
...
...
@@ -38,8 +38,8 @@ public record EmbeddedDatabaseConfiguration(String databaseName, String database
true
,
true
,
true
,
false
);
}
public
String
wrapUrlWithH2JdbcDriver
(
String
U
rl
){
return
JDBC_DRIVER_PREFIX
+
U
rl
+
getH2ParametersSuffix
();
public
String
wrapUrlWithH2JdbcDriver
(
String
u
rl
){
return
JDBC_DRIVER_PREFIX
+
u
rl
+
getH2ParametersSuffix
();
}
public
String
getInMemoryH2Url
()
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/database/EmbeddedDatabaseHandler.java
View file @
311c4372
...
...
@@ -121,17 +121,20 @@ public class EmbeddedDatabaseHandler {
try
(
Connection
con
=
dataSource
.
getConnection
())
{
try
(
PreparedStatement
dropPs
=
con
.
prepareStatement
(
"DROP TABLE IF EXISTS features"
)){
dropPs
.
executeUpdate
();
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
"Dropped existing features table"
);
}
logger
.
trace
(
"Dropped existing features table"
);
}
try
(
PreparedStatement
dropIndexPs
=
con
.
prepareStatement
(
"DROP INDEX IF EXISTS FEATURES_SPATIAL_INDEX"
)){
dropIndexPs
.
executeUpdate
();
logger
.
trace
(
"Dropped existing spatial index"
);
}
try
(
PreparedStatement
createPs
=
con
.
prepareStatement
(
"CREATE TABLE features (gmlid VARCHAR(255)"
+
" PRIMARY KEY, bbox GEOMETRY, data BLOB, errors BOOLEAN);"
))
{
createPs
.
executeUpdate
();
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
"Created features table"
);
}
//CREATE SPATIAL INDEX GEO_TABLE_SPATIAL_INDEX ON GEO_TABLE(THE_GEOM); <- Create spatial id
logger
.
trace
(
"Created features table"
);
}
try
(
PreparedStatement
createIndexPs
=
con
.
prepareStatement
(
"CREATE SPATIAL INDEX FEATURES_SPATIAL_INDEX ON features(bbox);"
)){
createIndexPs
.
executeUpdate
();
logger
.
trace
(
"Created spatial index"
);
}
}
catch
(
SQLException
e
)
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment