Taufiq
Taufiq

Reputation: 23

Spring: define @Table schema value in custom properties file or tomcat setenv.sh

Is it possible to define value of a schema in properties file or tomcat setenv.sh?

I have try this and its not working

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.context.annotation.PropertySource;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "EMPLOYEE", schema = "${DB_SCHEMA}")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public final class ComponentClientInformation{…}

setenv.sh

export DB_SCHEMA="DATABASE_OWNER"

the output is SELECT ... from ${DB_SCHEMA}.EMPLOYEE ...

app info:

Tomcat8

spring-framework-bom 4.3.3.RELEASE

the expectation is to be able to configure @Table schema value in custom properties file or tomcat setenv.sh

the output is SELECT ... from DATABASE_OWNER.EMPLOYEE ...

Upvotes: 0

Views: 24

Answers (0)

Related Questions