dao

EJB3 vs Data Access Objects

梦想与她 提交于 2019-12-06 10:54:50
问题 I am working on a project where we need to decide how we are going to expose our persistence layer. There are currently two options on the table: 1) Use plain DAOs. These would implement an interface and be injected (probably using Weld) in the Business Components which are EJBs. Internally they would use JPA/Hibernate for persistence. 2) Rather than injecting the DAOs using Weld, they would be implemented as EJBs, and injected with @EJB in the Business Components. Does it really make sense

How is an SOA architecture really supposed to be implemented?

寵の児 提交于 2019-12-06 10:53:18
问题 My project is converting a legacy fat-client desktop application into the web. The database is not changing as a result. Consequently, we are being forced to call external web services to access data in our own database. Couple this with the fact that some parts of our application are allowed to access the database directly through DAOs (a practice that is much faster and easier). The functionality we're supposed to call web services for are what has been deemed necessary for downstream,

SSM使用MybatisGenerator生成dao层

寵の児 提交于 2019-12-06 10:34:09
官网下载 mybatis generator 下载generator的release版本 mybatis-generator-core-1.4.0-bundle.zip https://github.com/mybatis/generator/releases SSM 构建基础spring mvc https://www.cnblogs.com/aeolian/p/11950980.html 整合Mybatis 除了mybatis官网下的 mybatis.jar 还需要 mybatis-spring.jar spring 与 mybatis对应 关系表 我使用的版本(之前用spring3.1整合失败,容器初始化报错升级成4.2.4的) <spring.version>4.2.4.RELEASE</spring.version> <mybatis.version>3.2.8</mybatis.version> <mybatis.spring.version>1.2.2</mybatis.spring.version> springconfig.xml配置 <!-- 让spring管理sqlsessionfactory 使用mybatis和spring整合包中的 --> <bean id="sqlSessionFactory" class="org.mybatis.spring

Converting DAO Recordset to Disconnected ADO Recordset dbDecimal Issue

。_饼干妹妹 提交于 2019-12-06 07:48:58
问题 In MS Access VBA (2007), I've written the functions below to convert a DAO recordset to a disconnected, in-memory ADO recordset. The problem is that I'm having data type conversion problems on the DAO dbDecimal fields. The problem shows up when I try to insert data from the DAO recordset into the newly created ADO recordset. When I get to the column that is type DAO dbDecimal (ADO adNumeric) I get the following error: Error -2147217887 (80040e21): Multiple-step operation generated errors.

Optional query parameters for Android Room

谁说胖子不能爱 提交于 2019-12-06 07:04:54
I have the following DAO with a query: @Dao public interface BaseballCardDao { @Query( "SELECT * FROM baseball_cards " + "WHERE brand LIKE :brand " + " AND year = :year " + " AND number LIKE :number " + " AND player_name LIKE :playerName " + " AND team LIKE :team" ) LiveData<List<BaseballCard>> getBaseballCards( String brand, int year, String number, String playerName, String team ); } The String parameters are "optional" in the sense that I can pass "%%" to match all rows due to the LIKE operator. But I cannot do this with year since it is an int . One solution is to add two different @Query

How to design DAOs when the datasource varies dynamically

我的未来我决定 提交于 2019-12-06 07:02:04
问题 Usually when defining a DAO, you would have a setter for the datasource on the DAO object. My problem is that our datasource varies dynamically based on the request to the server. i.e. every request can access different database instance. The request holds logical properties, that later can be used to retrieve the connection to the DB of the request. So when dependency injecting the DAO to the business logic object, I need a way to set the properties on the DAO at runtime (not configuration

Hibernate opening/closing session, the correct approach for DAO

我与影子孤独终老i 提交于 2019-12-06 07:01:58
问题 I have written this Hibernate object DAO, however with this approach, it is using session per update approach (which I don't think it's right). The reason why I don't think its right because I am running into problems with my User class, which contains collections that are lazily fetched. Since when retrieving each User from the DAO, the session is closed. Therefore I cannot get my collections. From time to time, it is also doing a lot of unnecessary updates to the table because the object is

Update linked tables in MS Access Database with C# programatically

有些话、适合烂在心里 提交于 2019-12-06 04:51:44
问题 I have two Access 2003 databases ( fooDb and barDb ). There are four tables in fooDb that are linked to tables in barDb . Two questions: How do I update the table contents (linked tables in fooDb should be synchronized with the table contents in barDb ) How do I re-link the table to a different barDb using ADO.NET I googled but didn't get any helpful results. What I found out is how to accomplish this in VB(6) and DAO, but I need a solution for C#. 回答1: If you're coding in C#, then Access is

Hibernate Update Query issue

女生的网名这么多〃 提交于 2019-12-06 04:38:52
For this update query update TestDB.dbo.MyEmp set empname=? where empid=? I wrote in my DAO class MyEmployee myEmployee = new MyEmployee(); MyEmployee myEmployee =(MyEmployee )session.load(MyEmployee.class, new Integer(1700)); myEmployee.setName("updatedName"); session.update(myEmployee ); Its working fine, but I need to know for this type of update query mentioned in below update TestDB.dbo.MyEmp set empsalary=? where empid=? && empname = ? (i.e., I need to update the table by using two conditions in where clause , this can be done by HQL , but i want to know how can we implement this by

Write Less DAOs with Spring Hibernate using Annotations

≯℡__Kan透↙ 提交于 2019-12-06 03:45:10
问题 My Spring+Hibernate configuration files are small and super tight. I use auto scanning to find my model entities/daos. I don't want to have to write a DAO + DAOImpl for EVERY Entity in my hierarchy. Some may qualify to have their own, like if they have complex relationships with other entities and require more than basic CRUD functionality. But for the rest... Is there any way to circumvent the defacto standard? Say, something like a generic DAO, ex: http://www.ibm.com/developerworks/java