Skip to content

Commit

Permalink
Merge pull request #497 from shopizer-ecommerce/rufina
Browse files Browse the repository at this point in the history
Postgres + Oracle support
  • Loading branch information
shopizer-ecommerce authored Oct 30, 2020
2 parents 917cae5 + 8ede91f commit 09feb86
Show file tree
Hide file tree
Showing 11 changed files with 229 additions and 90 deletions.
120 changes: 59 additions & 61 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
<infinispan.version>9.4.18.Final</infinispan.version>
<infinispan.tree.version>9.4.18.Final</infinispan.tree.version>
<mysql-jdbc-version>8.0.21</mysql-jdbc-version>
<oracle.version>18.3.0.0</oracle.version>
<postgresql.version>42.2.18</postgresql.version>
<simple-json-version>1.1.1</simple-json-version>
<jackson-version-databind>2.10.2</jackson-version-databind>
<jackson-version>2.10.2</jackson-version>
Expand All @@ -92,8 +94,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>


<dependency>
<groupId>com.shopizer</groupId>
<artifactId>sm-core</artifactId>
Expand Down Expand Up @@ -219,6 +219,27 @@
<version>${mysql-jdbc-version}</version>
</dependency>

<!-- For connecting to oracle
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>${oracle.version}</version>
</dependency>
-->

<!-- For connecting to postgresql -->
<!--
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
<scope>runtime</scope>
</dependency>
-->




<!-- Google Map API -->
<dependency>
<groupId>com.google.maps</groupId>
Expand Down Expand Up @@ -462,8 +483,8 @@
<artifactId>json-simple</artifactId>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand All @@ -485,6 +506,22 @@
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>

<!-- oracle
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
</dependency>
-->

<!-- postgres
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
-->


</dependencies>

<repositories>
Expand Down Expand Up @@ -525,36 +562,19 @@

<build>
<plugins>



<!--
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.3.0.603</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sonar</goal>
</goals>
</execution>
</executions>
</plugin>
-->




<!-- <plugin> <groupId>org.sonarsource.scanner.maven</groupId> <artifactId>sonar-maven-plugin</artifactId>
<version>3.3.0.603</version> <executions> <execution> <phase>verify</phase>
<goals> <goal>sonar</goal> </goals> </execution> </executions> </plugin> -->

<!-- sonar -->
<!--
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version>
</plugin>
-->



<!-- <plugin> <groupId>org.sonarsource.scanner.maven</groupId> <artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version> </plugin> -->



<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down Expand Up @@ -615,34 +635,12 @@
</executions>
</plugin>
<!--OSSRH -->
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
-->
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId>
<executions> <execution> <id>attach-javadocs</id> <goals> <goal>jar</goal>
</goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <version>1.5</version> <executions>
<execution> <id>sign-artifacts</id> <phase>verify</phase> <goals> <goal>sign</goal>
</goals> </execution> </executions> </plugin> -->

<plugin>
<groupId>org.jacoco</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ public class Product extends SalesManagerEntity<Long, Product> implements Audita
private Date dateAvailable = new Date();


@Column(name = "AVAILABLE", columnDefinition = "boolean default true", nullable = false)
private Boolean available = true;
@Column(name = "AVAILABLE")
private boolean available = true;


@Column(name = "PREORDER", columnDefinition = "boolean default false", nullable = false)
private Boolean preOrder = false;
@Column(name = "PREORDER")
private boolean preOrder = false;


@ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.REFRESH})
Expand All @@ -130,14 +130,13 @@ public class Product extends SalesManagerEntity<Long, Product> implements Audita
@JoinColumn(name="TAX_CLASS_ID", nullable=true)
private TaxClass taxClass;

@Column(name = "PRODUCT_VIRTUAL", columnDefinition = "boolean default false", nullable = false)
@Column(name = "PRODUCT_VIRTUAL")
private boolean productVirtual = false;

@Column(name = "PRODUCT_SHIP", columnDefinition = "boolean default false", nullable = false)
private Boolean productShipeable = false;
@Column(name = "PRODUCT_SHIP")
private boolean productShipeable = false;


@Column(name = "PRODUCT_FREE", columnDefinition = "boolean default false", nullable = false)
@Column(name = "PRODUCT_FREE")
private boolean productIsFree;

@Column(name = "PRODUCT_LENGTH")
Expand Down Expand Up @@ -442,11 +441,11 @@ public void setAvailable(Boolean available) {
}

public boolean isAvailable() {
return available != null ? available.booleanValue():false;
return available;
}

public boolean isProductShipeable() {
return productShipeable != null ? productShipeable.booleanValue():false;
return productShipeable;
}

public void setProductShipeable(Boolean productShipeable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import javax.persistence.TableGenerator;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.Type;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.salesmanager.core.constants.SchemaConstant;
import com.salesmanager.core.model.common.description.Description;
Expand All @@ -31,8 +29,7 @@ public class ProductOptionDescription extends Description {
@JoinColumn(name = "PRODUCT_OPTION_ID", nullable = false)
private ProductOption productOption;

@Column(name="PRODUCT_OPTION_COMMENT")
@Type(type = "org.hibernate.type.TextType")
@Column(name="PRODUCT_OPTION_COMMENT", length=4000)
private String productOptionComment;

public ProductOptionDescription() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,15 @@
)

@TableGenerator(name = "description_gen", table = "SM_SEQUENCER", pkColumnName = "SEQ_NAME", valueColumnName = "SEQ_COUNT", pkColumnValue = "customer_option_description_seq", allocationSize = SchemaConstant.DESCRIPTION_ID_ALLOCATION_SIZE, initialValue = SchemaConstant.DESCRIPTION_ID_START_VALUE)
//@SequenceGenerator(name = "description_gen", sequenceName = "customer_option_description_seq", allocationSize = SchemaConstant.DESCRIPTION_ID_SEQUENCE_START)
public class CustomerOptionDescription extends Description {
private static final long serialVersionUID = 1L;

@ManyToOne(targetEntity = CustomerOption.class)
@JoinColumn(name = "CUSTOMER_OPTION_ID", nullable = false)
private CustomerOption customerOption;

@Column(name="CUSTOMER_OPTION_COMMENT")
@Type(type = "org.hibernate.type.TextType")
private String customerOptionComment;


@Column(name = "CUSTOMER_OPTION_COMMENT", length=4000)
private String customerOptionComment;

public CustomerOptionDescription() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public class IntegrationModule extends SalesManagerEntity<Long, IntegrationModul
@Column(name = "REGIONS")
private String regions;

@Column(name = "CONFIGURATION")
@Type(type = "org.hibernate.type.TextType")
@Column(name = "CONFIGURATION", length=4000)
private String configuration;

@Column(name = "DETAILS")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*/
@Entity
@EntityListeners(value = AuditListener.class)
@Table(name = "USER", schema=SchemaConstant.SALESMANAGER_SCHEMA, uniqueConstraints=
@Table(name = "USERS", schema=SchemaConstant.SALESMANAGER_SCHEMA, uniqueConstraints=
@UniqueConstraint(columnNames = {"MERCHANT_ID", "ADMIN_NAME"}))
public class User extends SalesManagerEntity<Long, User> implements Auditable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
public interface PageableCategoryRepository extends PagingAndSortingRepository<Category, Long> {


@Query(value = "select distinct c from Category c left join fetch c.descriptions cd join fetch cd.language cdl join fetch c.merchantStore cm where cm.id=?1 and cdl.id=?2 and (?3 is null or cd.name like %?3%) order by c.lineage, c.sortOrder asc",
countQuery = "select count(c) from Category c join c.descriptions cd join c.merchantStore cm where cm.id=?1 and cd.language.id=?2 and (?3 is null or cd.name like %?3%)")
@Query(value = "select distinct c from Category c left join fetch c.descriptions cd join fetch cd.language cdl join fetch c.merchantStore cm where cm.id=?1 and cdl.id=?2 and (cd.name like %?3% or ?3 is null) order by c.lineage, c.sortOrder asc",
countQuery = "select count(c) from Category c join c.descriptions cd join c.merchantStore cm where cm.id=?1 and cd.language.id=?2 and (cd.name like %?3% or ?3 is null)")
Page<Category> listByStore(Integer storeId, Integer languageId, String name, Pageable pageable);


Expand Down
Binary file modified sm-shop/SALESMANAGER.h2.db
Binary file not shown.
Loading

0 comments on commit 09feb86

Please sign in to comment.