Search This Blog

Showing posts with label exclude. Show all posts
Showing posts with label exclude. Show all posts

Thursday, April 20, 2023

How to skip or exclude Spring Hibernate @entities @tables creation

 Step 1:

    In your application.properties 

spring.jpa.properties.hibernate.hbm2ddl.schema_filter_provider=<your class with pacakge>
spring.jpa.properties.hibernate.hbm2ddl.schema_filter_provider=com.drvijay.ExcludeFilter

or application.yml

spring:

  jpa:

    properties:

      hibernate:

        hbm2ddl:

          schema_filter_provider: com.drvijay.ExcludeFilter


Step 2: ExcludeFilter.java

package com.drvijay;

import java.util.Arrays;

import java.util.List;

import org.hibernate.boot.model.relational.Namespace;

import org.hibernate.boot.model.relational.Sequence;

import org.hibernate.mapping.Table;

import org.hibernate.tool.schema.spi.SchemaFilter;

import org.hibernate.tool.schema.spi.SchemaFilterProvider;

public class ExcludeFilter implements SchemaFilterProvider

{

@Override

public SchemaFilter getCreateFilter ()

{

return MySchemaFilter.INSTANCE;

}

@Override

public SchemaFilter getDropFilter ()

{

return MySchemaFilter.INSTANCE;

}

@Override

public SchemaFilter getMigrateFilter ()

{

return MySchemaFilter.INSTANCE;

}

@Override

public SchemaFilter getValidateFilter ()

{

return MySchemaFilter.INSTANCE;

}

}

class MySchemaFilter implements SchemaFilter

{

public static final MySchemaFilter INSTANCE = new MySchemaFilter ();

@Override

public boolean includeNamespace ( Namespace namespace )

{

return true;

}

@Override

public boolean includeTable ( Table table )

{

List <String> list = Arrays.asList ( "table1", "table2" );

if ( list.contains ( table.getName ().toLowerCase () ) )

{

return false;

}

return true;

}

@Override

public boolean includeSequence ( Sequence sequence )

{

return true;

}

}

Tuesday, June 16, 2020

Eclipse Spring boot - org.springframework.core.annotation.AnnotationConfigurationException: Attribute 'proxyBeanMethods'

1. Go to eclipse Help menu -> Eclipse marketplace.
2. find-> spring tools
3. select spring tools 4 -> install


4. on your spring boot application. keep only like below.
   @SpringBootApplication
   @ComponentScan ( "com.xxxx" )
5. on your pom.xml, change the parent tag

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


6. make sure all your spring-boot-xxx should be the same version 2.3.0.RELEASE

7. Exit eclipse and clear your workspace, re-import. compile and enjoy.

8. Also make sure all your jar related to spring is updated to recent version.


 

Hit Counter


View My Stats