日期:2014-05-17  浏览次数:20704 次

ssh框架如何动态连接表
现在有同样结构的数据表 table_txxxxx 几千个,用hibernate应该如何配置,不可能每个表都去映射,不知道怎么做了,求指点 


<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- 
  Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping package="com.pro.models">
  <class name="t_table" table="t05962" > //这里table 属性,能动态改变应该就可以了吗???
  <id name="mid" type="java.lang.Long">
  <generator class="assigned"></generator> 
  </id>
  <property name="curpostime" type="java.lang.String">
  <column name="curpostime" length="17" />
  </property>
  <property name="latitude" type="java.lang.String">
  <column name="latitude" length="12" />
  </property>
  <property name="longitude" type="java.lang.String">
  <column name="longitude" length="10" />
  </property>
  <property name="speed" type="java.lang.String">
  <column name="speed" length="5" />
  </property>
  <property name="direction" type="java.lang.String">
  <column name="direction" length="5" />
  </property>
  <property name="gpssn" type="java.lang.String">
  <column name="gpssn" length="12" />
  </property>
   
  </property>
   
  </class>
</hibernate-mapping>


------解决方案--------------------
hibernate直接用sql查询