解决方案 »
- EJB3 多对多问题,求解
- 网上下了个简单的dwr的页面聊天程序,一直报错
- 谁使用过ireport 做表格等???
- 有对配置spring拦截器熟悉的吗?花16元寻找解决
- java 下标越界如何解决
- 请问使用jxl如何设置一个sheet的背景图片呀!高分相赠!
- 有谁集成过spring+hibernate+webwork作为一个开发框架?
- 求助 谁有BEA Weblogic 8.1 的中文资料呀
- 请问,我用的是resin,我改了web.xml,但不能马上生效,我设定的dependency-check-interval是600秒,可我想让它马上生效,我应该怎么做(
- 请问UML的用例图中扩展(extend)和包含(include)的区别??
- mvc model
- 关于电子商务系统流程的疑问
public void saveTest() {
Session s = sessionFactory.openSession();
for (int i = 0; i < 100; i++) {
Tuser t = new Tuser(i + "");
s.save(t);
}
s.close();
} @Test
public void getTest() {
String mobilePhone = "1";
Session s = sessionFactory.openSession();
Tuser t = (Tuser) s.createQuery("from Tuser t where t.mobilePhone=?")
.setParameter(0, mobilePhone).uniqueResult(); logger.info(t);
logger.info(json(t)); s.close(); }
Hibernate:
select
tuser0_.ID as ID0_,
tuser0_.MOBILEPHONE as MOBILEPH2_0_
from
TUSER tuser0_
where
tuser0_.MOBILEPHONE=?
[test.UserDaoImplTest]entity.Tuser@22976eda
[test.UserDaoImplTest]{"id":3,"mobilePhone":"1"}
这怎么会出不来呢,我这就建了一个Dao就出来了呀。
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd"> <context:component-scan base-package="com.hirisun.xx.sshTest" />
<!-- 数据源 -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:orcl" />
<property name="username" value="workUser " />
<property name="password" value="work" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.current_session_context_class">org.springframework.orm.hibernate4.SpringSessionContext</prop>
</props>
</property>
<property name="packagesToScan">
<list>
<value>com.hirisun.xx.sshTest.bean</value>
</list>
</property>
</bean> <bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
</beans>帮我看看问题出那了,谢谢了。