论坛首页 Java企业应用论坛

SchemaUpdate 如何让它正确找schema?

浏览 4907 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2007-03-30  
DB:oracle 9i
在同一个数据库实例里面有两个用户:CS 和TEST ,为了测试两个用户下面建了很多同名的表,比如cs.card和test.card表。
我用test用户连接db调用SchemaUpdate 发现竟然去找的cs下面的表,然后更新表结构就更是不知道更新到哪个schema去了。后面发现可以设置hibernate.default_schema=test,但是去匹配的表还是 cs下面的表,而去更新的确实test下面的表,真晕。
ant结果如下:
引用

[schemaupdate] 信息: table found: CS.CARD
[schemaupdate] 2007-3-30 13:32:12 org.hibernate.tool.hbm2ddl.TableMetadata <init>
[schemaupdate] 信息: columns: [times_y, distrustful_times, card_limit, owe_amount, id, card_number, monthly_pay, id_type, customer_id, correct_percent_hy, limit_use_pecent_y, last_adjust_date, record_date, amount_y, daily_balance_y, open_date, card_class, distrustful_amount, owe_times, correct_amount_y, correct_percent_y, times_hy, customr_limit, amount_hy, correct_amount_hy, limit_use_pecent_hy, state, daily_balance_hy]
...
[schemaupdate] alter table TEST.CARD add ACCOUNT_LIMIT double precision default 0 not null

事实上TEST.CARD 表里面ACCOUNT_LIMIT 已经存在,CS.CARD里面确实还没有ACCOUNT_LIMIT

问题参考:http://forum.hibernate.org/viewtopic.php?t=972447&sid=a5e67497d46c525eaf1e766f64062fbb
引用


I'm trying to create a schema upgrade script via HBM2DDL and I'm running into an anomaly. When the tool looks up a table in the Oracle catalog, it doesn't specify the "owner" or "schema" name (the user id that I specified in the JDBC connection parms). It finds the first table with a matching name and creates SQL Alter Table stmts accordingly. Unfortunately, the table names as specified in my HBM files occur many times within my Oracle instance, under many different User IDs. Sometimes it finds the correct table but most times it encounters the wrong table.

Is there a parameter I can specify that would limit the tool to finding only tables owned by a specific User ?

I'm using the tool from within an ANT target on Widows XP.

   发表时间:2007-03-30  
用户的权限给得太大了
0 请登录后投票
   发表时间:2007-04-02  
是不是xml的schema写错了?
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics