作業中のhibernateプロジェクトをSpring hibernate Projectに変換しています。既存のプロジェクト・セッション・ファクトリの作成は、hibernate cfg file.Since春のために行くイム私はjava.Iに設定することにより、Localsessionfactoryを経由してセッションの作成を修正はhiberateのCFGのルックアップで細かい作業java.sql.SQLSyntaxErrorException:ORA-00942:表またはビューが存在しません。Springデータ・ソース
ORA-00942: table or view does not exist
しかし、同じ以下のように、1つの奇妙な例外を取得しています。
私は私のコードである リポジトリCLAS
2 transcationマネージャ.Belowを使用しています@Repository
public class TestImpl implements
TestRepository {
@Autowired
@Qualifier("fSessionFactory")
SessionFactory sessionFactory;
@Autowired
@Qualifier("dSessionFactory")
SessionFactory sessionFactory2;
@SuppressWarnings("unchecked")
@Transactional("dTransaction")
public Recordse getOrders(String code, int id ) throws PersistenceException {
Session session = null;
try {
session =sessionFactory.getCurrentSession();
List<Order> orderList = session
.createQuery("FROM Orders WHERE CODE = :code AND NUM_CC = :id ")
.setParameter("code", code)
.setParameter("id", id)
.list();
}
catch (Exception e) {
throw new PersistenceException(e);
}
return empSickTime ;
}
@Transactional("fTransaction")
@Override
public SelectedRecords getRecords(String code, String grpId) throws PersistenceException {
Session session = null;
try {
session = sessionFactory2.getCurrentSession();
List<Records> recList = session
.createQuery("FROM Records WHERE CODE = :code AND GRP_CC = :id ")
.setParameter("code", code)
.setParameter("id", id)
.list();
}
}
catch (HibernateException e) {
throw new PersistenceException(e);
}
return qualifiedFleet;
}
}
PersistencConfig1
が@Configuration
@EnableTransactionManagement
@PropertySource({ "classpath:persistence.properties" })
@ComponentScan({ "com.test.test2.*" })
public class PersistenceConfiguration1 {
@Autowired
private Environment env;
@Bean(name=" ")
public LocalSessionFactoryBean sessionFactory() {
LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
sessionFactory.setDataSource(testDataSource());
sessionFactory.setPackagesToScan(new String[] {
" com.test.test2"});
sessionFactory.setHibernateProperties(hibernateProperties1());
return sessionFactory;
}
@Bean
public DataSource testDataSource() {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName"));
dataSource.setUrl(env.getProperty("jdbc.url"));
dataSource.setUsername(env.getProperty("jdbc.user"));
dataSource.setPassword(env.getProperty("jdbc.pass"));
return dataSource;
}
@Bean(name="dTransaction")
@Autowired
public HibernateTransactionManager transactionManager(
SessionFactory sessionFactory) {
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(sessionFactory);
return txManager;
}
@Bean
public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
return new PersistenceExceptionTranslationPostProcessor();
}
Properties hibernateProperties1() {
return new Properties() {
{
setProperty("hibernate.hbm2ddl.auto",
env.getProperty("hibernate.hbm2ddl.auto"));
setProperty("hibernate.dialect",
env.getProperty("hibernate.dialect"));
setProperty("hibernate.globally_quoted_identifiers", "true");
}
};
}
}
PersistenceConfig2
@Configuration
@EnableTransactionManagement
@PropertySource({ "classpath:persistence.properties" })
@ComponentScan({ "com.test.test3.*" })
public class PersistenceConfigurationDOTC {
@Autowired
private Environment env;
@Bean(name="dSessionFactory")
public LocalSessionFactoryBean sessionFactory() {
LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
sessionFactory.setDataSource(test1DataSource());
sessionFactory.setPackagesToScan(new String[] {
"com.test.test3.entity"});
sessionFactory.setHibernateProperties(hibernateProperties());
return sessionFactory;
}
@Bean
public DataSource test1DataSource() {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(env.getProperty("jdbc1.driverClassName"));
dataSource.setUrl(env.getProperty("jdbc1.url"));
dataSource.setUsername(env.getProperty("jdbc1.user"));
dataSource.setPassword(env.getProperty("jdbc1.pass"));
return dataSource;
}
@Bean(name = "fTransaction")
@Autowired
public HibernateTransactionManager transactionManager() {
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(sessionFactoryFCDS().getObject());
return txManager;
}
Properties hibernateProperties() {
return new Properties() {
{
setProperty("hibernate.hbm2ddl.auto",
env.getProperty("hibernate.hbm2ddl.auto"));
setProperty("hibernate.dialect",
env.getProperty("hibernate.dialect"));
setProperty("hibernate.globally_quoted_identifiers", "true");
}
};
}
}
私は何を欠場しましたか?
対
var1
を混在しないようにあなたはそれを確認する? – Michal