Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SchemaManagementException found [text (Types#LONGVARCHAR)], but expecting [varchar(255) (Types#VARCHAR)] #7484

Closed
alex-135 opened this issue Nov 25, 2016 · 1 comment

Comments

@alex-135
Copy link

commented Nov 25, 2016

spring boot pom.xml

org.springframework.boot
spring-boot-starter-parent
1.4.1.RELEASE

applicatoin:
@EnableDiscoveryClient
@SpringBootApplication
public class Application {
public static void main(String[] args) {
new SpringApplicationBuilder(Application.class).web(true).run(args);
}
}

@configuration
@EnableTransactionManagement
@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactoryPrimary", transactionManagerRef = "transactionManagerPrimary", basePackages = {
"com.respority" })
public class PrimaryConfig {
@Autowired
private JpaProperties jpaProperties;

@Autowired
@Qualifier("primaryDataSource")
private DataSource primaryDataSource;

@Bean(name = "entityManagerPrimary")
@Primary
public EntityManager entityManager(EntityManagerFactoryBuilder builder) {
	return entityManagerFactoryPrimary(builder).getObject().createEntityManager();
}

@Bean(name = "entityManagerFactoryPrimary")
@Primary
public LocalContainerEntityManagerFactoryBean entityManagerFactoryPrimary(EntityManagerFactoryBuilder builder) {
	return builder.dataSource(primaryDataSource).properties(getVendorProperties(primaryDataSource))
			.packages("com.entity") 
			.persistenceUnit("primaryPersistenceUnit").build();
}

private Map<String, String> getVendorProperties(DataSource dataSource) {
	return jpaProperties.getHibernateProperties(dataSource);
}

@Bean(name = "transactionManagerPrimary")
@Primary
PlatformTransactionManager transactionManagerPrimary(EntityManagerFactoryBuilder builder) {
	return new JpaTransactionManager(entityManagerFactoryPrimary(builder).getObject());
}

}

entity:
@column(name = "description", nullable = false, length = 65535, columnDefinition="TEXT")
private String description;// mysql 5.6

Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [description] in table [table]; found [text (Types#LONGVARCHAR)], but expecting [varchar(255) (Types#VARCHAR)]

@snicoll

This comment has been minimized.

Copy link
Member

commented Nov 25, 2016

Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.