Teiid Spring boot and java persistence types
tamarm Jan 30, 2019 11:14 AMHi,
I am using Teiid Spring boot with postgres view as datasource.
I have a column in postgres view defined as (sql) integer,
I created virtual view (in java class) using Teiid's @SelectQuery and defined this column with (java) Integer :
@Entity
@Table(name="CreditCardInfo")
@SelectQuery("SELECT customer_id, expire_month, expire_year, card_holder_name FROM aggregatedSources.credit_card_info_view")
public class CreditCardHolderView {
@Id
String customer_id;
@Column
int expire_month;
@Column
int expire_year;
@Column
String card_holder_name;
when uploading the server I get the error:
java.lang.IllegalStateException: Failed to deploy the VDB file
at org.teiid.spring.autoconfigure.TeiidServer.deployVDB(TeiidServer.java:260)
at org.teiid.spring.autoconfigure.TeiidPostProcessor.onApplicationEvent(TeiidPostProcessor.java:138)
at org.teiid.spring.autoconfigure.TeiidPostProcessor.onApplicationEvent(TeiidPostProcessor.java:52)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:399)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration.createChildManagementContext(EndpointWebMvcAutoConfiguration.java:193)
at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration.afterSingletonsInstantiated(EndpointWebMvcAutoConfiguration.java:156)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:781)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at com.behalf.odata_service.ODataServiceApplication.main(ODataServiceApplication.java:9)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.teiid.deployers.VirtualDatabaseException: TEIID40095 TEIID31080 teiid.CreditCardInfo validation error: The definition for teiid.CreditCardInfo has the wrong type for column 2. Expected string, but was integer.
how can I create a virtual view with integer type?