1

I'm using Spring boot and when I trying to run and generate tables, I don't have any results in my database Oracle.

Here is my application.properties:

spring.main.banner-mode=off
# Set true for first time db initialization.
spring.datasource.initialize=true

#spring.datasource.url=jdbc:oracle:thin:@192.168.1.22:1521:DRUGSTORE
spring.datasource.url=jdbc:oracle:thin:@//192.168.1.22:1521/DRUGSTORE
spring.datasource.username=PHARM
spring.datasource.password=PHARM
spring.datasource.schema-password=PHARM
spring.datasource.schema-username=PHARM
spring.jpa.properties.hibernate.default_schema = PHARM
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.generate-ddl=true
spring.jpa.show-sql=true
spring.jpa.database=oracle
spring.datasource.dbcp2.initial-size=7
spring.datasource.dbcp2.max-total=20
spring.datasource.dbcp2.pool-prepared-statements=true
spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect

Here is a sample entity:

import java.io.Serializable; import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "ADRESSE")
public class Adresse implements Serializable{
    @Id  
    @GeneratedValue(strategy=GenerationType.TABLE)
    @Column(name="ID_ADRESSE",length=255)
    private BigDecimal idAdresse;
    @Column(name="LINE_1",length=255)
    private String line1;
    @Column(name="LINE_2",length=255)
    private String line2;
    @Column(name="LINE_3",length=255)
    private String line3;
    @Column(name="LONGITUDE",length=255)
    private Double longitude;
    @Column(name="LATITUDE",length=255)
    private Double latitude;
    @ManyToOne(targetEntity=Ville.class)
    @Basic(fetch = FetchType.LAZY)
    private Ville ville;
    @Column(name="CREATE_DATE",length=50)
    @Temporal(TemporalType.DATE)
    private Date createDate ;
    @Column(name="LAST_UPDATE" ,length=50)
    @Temporal(TemporalType.DATE)
    private Date lastUpdate ;

    public String getLine1() {
        return line1;
    }
    public void setLine1(String line1) {
        this.line1 = line1;
    }
    public String getLine2() {
        return line2;
    }
    public void setLine2(String line2) {
        this.line2 = line2;
    }
    public String getLine3() {
        return line3;
    }
    public void setLine3(String line3) {
        this.line3 = line3;
    }
    public Double getLongitude() {
        return longitude;
    }
    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }
    public Double getLatitude() {
        return latitude;
    }
    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }
    public Ville getVille() {
        return ville;
    }
    public void setVille(Ville ville) {
        this.ville = ville;
    }

    public Date getCreateDate() {
        return createDate;
    }
    public BigDecimal getIdAdresse() {
        return idAdresse;
    }
    public void setIdAdresse(BigDecimal idAdresse) {
        this.idAdresse = idAdresse;
    }
    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
    public Date getLastUpdate() {
        return lastUpdate;
    }
    public void setLastUpdate(Date lastUpdate) {
        this.lastUpdate = lastUpdate;
    }
    public Adresse(String line1, String line2, String line3, Double 
        longitude, Double latitude, Ville ville,Date createDate ,Date
        lastUpdate) {
        super();
        this.line1 = line1;
        this.line2 = line2;
        this.line3 = line3;
        this.longitude = longitude;
        this.latitude = latitude;
        this.ville = ville;
        this.lastUpdate=lastUpdate;
        this.createDate =createDate;
    }
    public Adresse() {
        super();
    }

}
1
  • 2
    Do you get any exceptions in the console. it would be helpful if you could share the stack-trace . Commented May 10, 2017 at 0:34

1 Answer 1

1

Replace

spring.jpa.hibernate.ddl-auto=create-drop

with

spring.jpa.hibernate.ddl-auto=update
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.