我使用Spring Boot和Data Rest在Java8中创建一个简单的微服务并获得postgres异常.
我的实体:
@Entity
public class ArchivedInvoice implements Serializable {
...
@Column
private String invoiceNumber;
@Column
private java.sql.Date invoiceDate;
...
}
Run Code Online (Sandbox Code Playgroud)
我的存储库界面:
@RepositoryRestResource(collectionResourceRel = "archivedinvoices", path = "archivedinvoices")
public interface ArchivedInvoiceRepository extends PagingAndSortingRepository < ArchivedInvoice, Long > {
...
@RestResource(rel = "findByXYZ", path = "findByXYZ")
@Query(value = "SELECT ai FROM #{#entityName} ai WHERE "
+ "(:invoiceNumber IS NULL OR ai.invoiceNumber LIKE :invoiceNumber) AND "
+ "(:invoiceDate IS NULL OR ai.invoiceDate = :invoiceDate)"
)
public Page < ArchivedInvoice > findByXYZ( …Run Code Online (Sandbox Code Playgroud) 我正在使用Liquibase,并希望以两种不同的变体(生产和测试)执行相同的脚本:
<changeSet author="..." id="...">
<insert tableName="...">
<column name="ACTIVE" value="${isActive}" />
</insert>
</changeset>
Run Code Online (Sandbox Code Playgroud)
目前,我使用一个属性来控制它在两个文件中:
<!--File1: For production -->
<property name="isActive" value="true"/>
<!--File2: For tests-->
<property name="isActive" value="false"/>
Run Code Online (Sandbox Code Playgroud)
有没有办法使用类似配置文件(如在Maven中)或在Liquibase中使用命令行参数?我想避免处理两个不同的文件,一个用于生产,一个用于测试系统.
我在具有不同postgres版本的两台服务器上执行相同的sql脚本.第一个有postgres 9.4.4(这个工作正常),另一个9.5(这会抛出异常)安装.
UPDATE archived_invoice SET encrypted_xml
= encrypt(xml::bytea, 'MySuperSecretKey'::bytea, 'aes-ecb/pad:pkcs')
Run Code Online (Sandbox Code Playgroud)
例外:
Caused by: org.postgresql.util.PSQLException: ERROR: invalid input syntax for type bytea
SQL Status:22P02
Run Code Online (Sandbox Code Playgroud)
这两个postgresql版本之间有什么区别吗?