Spring and packagesToScan

#1

Hi i am trying to configure ObjectDB using Spring JavaConfig but packageToScan is not working. I am getting Type XXX is not found

 

LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setPackagesToScan("com.myentities");
factory.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver());
factory.setPersistenceProviderClass(com.objectdb.jpa.Provider.class);

        Map jpa = MapBuilder.
                put("javax.persistence.jdbc.url", "objectdb://localhost:6136/mydb.odb",
                        "javax.persistence.jdbc.user", "admin",
                        "javax.persistence.jdbc.password", "admin");

factory.setJpaPropertyMap(jpa);
factory.afterPropertiesSet();

mydb.odb is created but when i try to query "select p from Person p" throw com.objectdb.o.TEX: Type com.myentities.Person is not found.

I need packageToScan because there are many jar files with entities under "com.myentities." package and subpackage

#2

Try to define a persistence unit and declare the class in that persistence unit.

See also this forum thread.

ObjectDB Support

Reply