Skip to content

Commit

Permalink
added prod profile
Browse files Browse the repository at this point in the history
  • Loading branch information
carron10 committed Jun 20, 2024
1 parent 176247e commit 4e7e4c9
Show file tree
Hide file tree
Showing 10 changed files with 3,384 additions and 22 deletions.
Binary file modified TicketSystemDB_dev.mv.db
Binary file not shown.
3,296 changes: 3,296 additions & 0 deletions TicketSystemDB_dev.trace.db

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions nbactions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<goal>org.codehaus.mojo:exec-maven-plugin:3.1.0:exec</goal>
</goals>
<properties>
<exec.vmArgs>-Dspring.profiles.active=dev</exec.vmArgs>
<exec.vmArgs>-Dspring.profiles.active=prod</exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.appArgs>-Dspring.profiles.active=dev</exec.appArgs>
<exec.appArgs>-Dspring.profiles.active=prod</exec.appArgs>
<exec.mainClass>com.ticket.TicketSystem.TicketSystemApplication</exec.mainClass>
<exec.executable>java</exec.executable>
</properties>
Expand All @@ -27,9 +27,9 @@
<goal>org.codehaus.mojo:exec-maven-plugin:3.1.0:exec</goal>
</goals>
<properties>
<exec.vmArgs>-Dspring.profiles.active=dev -agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</exec.vmArgs>
<exec.vmArgs>-Dspring.profiles.active=prod -agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.appArgs>-Dspring.profiles.active=dev</exec.appArgs>
<exec.appArgs>-Dspring.profiles.active=prod</exec.appArgs>
<exec.mainClass>com.ticket.TicketSystem.TicketSystemApplication</exec.mainClass>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
Expand All @@ -45,11 +45,11 @@
<goal>org.codehaus.mojo:exec-maven-plugin:3.1.0:exec</goal>
</goals>
<properties>
<exec.vmArgs>-Dspring.profiles.active=dev</exec.vmArgs>
<exec.vmArgs>-Dspring.profiles.active=prod</exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.mainClass>com.ticket.TicketSystem.TicketSystemApplication</exec.mainClass>
<exec.executable>java</exec.executable>
<exec.appArgs>-Dspring.profiles.active=dev</exec.appArgs>
<exec.appArgs>-Dspring.profiles.active=prod</exec.appArgs>
</properties>
</action>
<action>
Expand Down
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.7.3</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.icegreen/greenmail -->
<!-- https://mvnrepository.com/artifact/com.icegreen/greenmail -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.ticket.TicketSystem;

/**
*
* @author Carron Muleya
*/
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;

public class CustomPhysicalNamingStrategy implements PhysicalNamingStrategy {

private static final String TABLE_PREFIX = "bf_";

@Override
public Identifier toPhysicalCatalogName(Identifier name, JdbcEnvironment context) {
return apply(name);
}

@Override
public Identifier toPhysicalSchemaName(Identifier name, JdbcEnvironment context) {
return apply(name);
}

@Override
public Identifier toPhysicalTableName(Identifier name, JdbcEnvironment context) {
return apply(name);
}

@Override
public Identifier toPhysicalSequenceName(Identifier name, JdbcEnvironment context) {
return apply(name);
}

@Override
public Identifier toPhysicalColumnName(Identifier name, JdbcEnvironment context) {
return name;
}

private Identifier apply(Identifier name) {
if (name == null) {
return null;
}
String newName = TABLE_PREFIX + name.getText();
return Identifier.toIdentifier(newName);
}
}

2 changes: 1 addition & 1 deletion src/main/java/com/ticket/TicketSystem/entities/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class Game {
private String feature_img;


@OneToMany(mappedBy = "game", cascade = CascadeType.ALL, orphanRemoval = true)
@OneToMany(mappedBy = "game", cascade = CascadeType.ALL, orphanRemoval = true)
@JsonManagedReference(value = "game-tickets")
private List<GameTicket> tickets;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class GameTicket {
private Ticket ticket;

@OneToMany(mappedBy = "ticket")
@JsonManagedReference
@JsonManagedReference(value = "game-tickets")
private List<Order> orders;

/**
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/ticket/TicketSystem/entities/Ticket.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public class Ticket {

private String description;

@OneToMany(mappedBy = "ticket")
@JsonManagedReference(value = "game-tickets")
private List<GameTicket> gameTickets;
// @OneToMany(mappedBy = "ticket")
// @JsonManagedReference(value = "game-tickets")
// private List<GameTicket> gameTickets;

//The type of ticket
@Column(unique=true)
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/application-dev.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ spring.datasource.username=sa
spring.datasource.password=1234
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.enabled=true
#spring.jpa.generate-ddl=true
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
#spring.jpa.hibernate.ddl-auto =create-drop
#logging.level.org.hibernate.SQL=DEBUG
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
Expand Down
26 changes: 16 additions & 10 deletions src/main/resources/application-prod.properties
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@

logging.level.web=Debug


# H2 Database
spring.datasource.url=jdbc:h2:file:./TicketSystemDB_dev
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=1234
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.enabled=true
#spring.jpa.generate-ddl=true
spring.jpa.hibernate.naming.physical-strategy=com.ticket.TicketSystem.CustomPhysicalNamingStrategy
spring.datasource.url=jdbc:postgresql://dpg-cppk25aj1k6c73ek8ghg-a.oregon-postgres.render.com/all_store_db_c0eu
spring.datasource.username=all_store_db_c0eu_user
spring.datasource.password=FcQt8HtrNIqCds1osp0rDrPqQeN2ql7X
spring.datasource.driverClassName=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.datasource.initialization-mode=always
spring.datasource.initialize=true
spring.datasource.continue-on-error=true
#spring.jpa.hibernate.ddl-auto =create-drop
#logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.SQL=DEBUG
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE

#security.basic.enabled=false
Expand All @@ -29,5 +34,6 @@ spring.devtools.restart.additional-paths=static/,templates/
#spring.mail.properties.mail.transport.protocol=smtp
#spring.mail.properties.mail.smtp.auth=false
#spring.mail.properties.mail.smtp.starttls.enable=false
paynow.return.domain_url=http://localhost:8080
paynow.results.domain_url=https://muskrat-magnetic-escargot.ngrok-free.app
paynow.return.domain_url=https://bfticketbookingsystem.azurewebsites.net/
paynow.results.domain_url=https://bfticketbookingsystem.azurewebsites.net/

0 comments on commit 4e7e4c9

Please sign in to comment.