NutzCN Logo
问答 多源数据库如何各自使用pojo?
发布于 1955天前 作者 wx_chrohf6r75suj7q2r8fh 1798 次浏览 复制 上一个帖子 下一个帖子
标签:

一个SQL一个ORECL,都有POJO,如何各自申明,在启动的时候,只认了一个啊

来自炫酷的 NutzCN

8 回复

@IocBean(args={"refer:dataSourceorcl"})
@Table("scott.zzh_obd")
public class zzh_obd {
@Column
private String EQP_NAME;
@Column
private String DIRE_NO;
@Column


Caused by: java.lang.RuntimeException: class=sjk.zzh_obd
at org.nutz.dao.util.Daos.createTables(Daos.java:547)
at org.nutz.dao.util.Daos.createTablesInPackage(Daos.java:463)
at main.MainSetup.init(MainSetup.java:25)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:278)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
... 54 more
Caused by: org.nutz.dao.DaoException: !Nutz SQL Error: 'CREATE TABLE scott.zzh_obd(
EQP_NAME VARCHAR(128),
DIRE_NO VARCHAR(128),
OLT_IP VARCHAR(128),
PON_XH VARCHAR(128))'
PreparedStatement:
'CREATE TABLE scott.zzh_obd(
EQP_NAME VARCHAR(128),
DIRE_NO VARCHAR(128),
OLT_IP VARCHAR(128),
PON_XH VARCHAR(128))'
CaseMessage=指定的架构名称 "scott" 不存在,或者您没有使用该名称的权限。
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:104)
at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:159)
at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:126)
at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:93)
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:82)
at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
at org.nutz.dao.impl.DaoSupport.execute(DaoSupport.java:236)
at org.nutz.dao.impl.NutDao.execute(NutDao.java:1013)
at org.nutz.dao.impl.jdbc.sqlserver2005.Sqlserver2005JdbcExpert.createEntity(Sqlserver2005JdbcExpert.java:85)
at org.nutz.dao.impl.NutDao.create(NutDao.java:817)
at org.nutz.dao.util.Daos.createTables(Daos.java:544)
... 58 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: 指定的架构名称 "scott" 不存在,或者您没有使用该名称的权限。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1493)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:775)
at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:676)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:649)
at com.alibaba.druid.pool.DruidPooledStatement.execute(DruidPooledStatement.java:416)
at org.nutz.dao.impl.sql.run.NutDaoExecutor._runStatement(NutDaoExecutor.java:357)
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:60)
... 73 more

```
还是白塔认为是前一个源啊

pojo类不支持制定数据源的, 是dao操作的时候, 选不同的dao实例来操作

是不同dao对应不同的dataSource, 然后用dao操作pojo, 不是pojo指定自己用哪个数据源

那NUTZ不支持多个数据源定制POJO?只能通过sql语句来操作?

@Table("scott.zzh_obd")这句话如何在启用其他源时告知DAO?

pojo不能控制自己用哪个数据源

添加回复
请先登陆
回到顶部