Skip to content

Commit

Permalink
Starting Schema Less
Browse files Browse the repository at this point in the history
  • Loading branch information
isontheline committed May 18, 2024
1 parent 58dcedd commit 514f88a
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 0 deletions.
47 changes: 47 additions & 0 deletions backend/src/main/java/ai/dragon/entity/schemaless/SLKeyEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package ai.dragon.entity.schemaless;

import java.util.Date;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Index;
import jakarta.persistence.Table;

@Entity
@Table(name = "slkey", indexes = {
@Index(columnList = "keyid", unique = true)
})
public class SLKeyEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long rowid;
private String keyid;
private Date updatedAt;

public Long getRowid() {
return rowid;
}

public void setRowid(Long rowid) {
this.rowid = rowid;
}

public String getKeyid() {
return keyid;
}

public void setKeyid(String keyid) {
this.keyid = keyid;
}

public Date getUpdatedAt() {
return updatedAt;
}

public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package ai.dragon.entity.schemaless;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Index;
import jakarta.persistence.Table;

@Entity
@Table(name = "slvalue", indexes = {
@Index(columnList = "keyid"),
@Index(columnList = "rowattribute")
})
public class SLValueEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long rowid;
private String keyid;
private String rowattribute;
private String rowvalue;

public Long getRowid() {
return rowid;
}

public void setRowid(Long rowid) {
this.rowid = rowid;
}

public String getKeyid() {
return keyid;
}

public void setKeyid(String keyid) {
this.keyid = keyid;
}

public String getRowattribute() {
return rowattribute;
}

public void setRowattribute(String rowattribute) {
this.rowattribute = rowattribute;
}

public String getRowvalue() {
return rowvalue;
}

public void setRowvalue(String rowvalue) {
this.rowvalue = rowvalue;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package ai.dragon.repository.schemaless;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import ai.dragon.entity.schemaless.SLKeyEntity;

@Repository
public interface SLKeyEntityRepository extends JpaRepository<SLKeyEntity, Integer> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package ai.dragon.repository.schemaless;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import ai.dragon.entity.schemaless.SLValueEntity;

@Repository
public interface SLValueRepository extends JpaRepository<SLValueEntity, Integer> {

}
3 changes: 3 additions & 0 deletions backend/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ spring:
username: "sa"
password: ""
database-platform: "org.hibernate.dialect.H2Dialect"
jpa:
hibernate:
ddl-auto: "update"
devtools:
restart:
enabled: true
Expand Down

0 comments on commit 514f88a

Please sign in to comment.