dao

Opening a password encrypted access database using DAO VB.NET

I create a database like this: Sub Main() Dim wrkDefault As Workspace Dim dbE As DBEngine Dim dbs As Database 'Get default Workspace. dbE = New DBEngine wrkDefault = dbE.Workspaces(0) 'Set the database filename Dim DBFilename As String DBFilename = "c:\mydb.mdb" ...

creative way for implementing Data object with its corresponding business logic class in java

I have a class that need to be serialized (for both persistentcy and client-server communication) for simplicity's sake let's call the classes Business a BusinessData and I prefix for their Interfaces. All the getter and setter are delegated from Business class to BusinessData class. I thought about implementing IBusinessData interfa...

jdbctemplate query() vs entityManager createQuery()

Hi. What is essential difference between these methods? query() of JdbcTemplate and createQuery() of EntityManager? As I understand, both execute query? ...

dao as a member of a servlet - normal?

I guess, DAO is thread safe, does not use any class members. So can it be used without any problem as a private field of a Servlet ? We need only one copy, and multiple threads can access it simultaneously, so why bother creating a local variable, right? ...

generic DAO in java

I am trying to develop generic DAO in java.I have tried the following.Is this a good way to implement generic dao?I dont want to use hibernate.I am trying to make it as generic as possible so that i dont have to repeate the same code again and again. public abstract class AbstractDAO<T> { protected ResultSet findbyId(String tab...

Will existing DAO code work against a SQL Server?

If I transfer data from a Access MDB into a SQL Server, will DAO code in a VB app work against the SQL Server. I realise there will need to be changes to the initial connection calls but will anything else need to change? ...

Up to date, JPA compliant GenericDAO Implementation

I read this article: http://www.ibm.com/developerworks/java/library/j-genericdao.html several times and believe I understand what it is saying. However, it is 4 years old and I have a JPA compliant Java application to contend with. In addition, I see that there is a JPATemplate in Spring that has some good functionality, but the Spri...

DAO method retrieve single entry

Hello, How can I write DAO method which will return as a result only first entry from the database. For instance lets say I'm looking at Users table and I want to retrieve only the first entry, I'd declare method like: public User getFirstUser(){ //method logic } EDIT: User has primary key id if that matters at all. I apologize...

JPA - FindByExample

Does anyone have a good example for how to do a findByExample in JPA that will work within a generic DAO via reflection for any entity type? I know I can do it via my provider (Hibernate), but I don't want to break with neutrality... Seems like the criteria API might be the way to go....but I am not sure how to handle the reflection p...

pattern to transfer search model to dao

We have a dao as a project (jar file). Clients use its interfaces and factories to operate with database. Alongside with standard CRUD operations, dao allows you to search an entity by some search criteria. What is the best way to represent this criteria? Is transfer object appropriate pattern in this situation? How should client cr...

Are multiple DAOs with jdbctemplate constructor injection a multi-threading risk?

I've got a large multi-threaded webapp in which I am passing in jdbcTemplates into DAO classes via constructor injection. Is this a multi-threading risk? Should I be passing in just the datasource instead? ...

Hibernate Tools - DAO generation

Hello, I am using the eclipse hibernate tools plug-in to reverse engineer my database. I spent my whole day looking for how to force the DAO generator to use HQL/Criteria with the session factory, transaction, etc. Right now, if I have the table TABLE in my database, I obtain the DAO class TableHome. This class uses the persistence Enti...

Should integration testing of DAOs be done in an application server?

I have a three tier application under development and am creating integration tests for DAOs in the persistence layer. When the application runs in Websphere or JBoss I expect to use the connection pooling and transaction manager of those application servers. When the application runs in Tomcat or Jetty, we'll be using C3P0 for pooling...

Determine used DAO version

Simple (?) question: how can I determine the used DAO version in VBA code? ...

CurrentDb.RecordsAffected returns 0. Why?

If I use RecordsAffected with CurrentDb.Execute, it always returns 0. If I first make a instance of a Database object it works properly. Why? Like this: Dim Db As Database Set Db = CurrentDb Db.Execute "DELETE * FROM [Samples] WHERE Sample=5" If Db.RecordsAffected = 0 Then MsgBox "Error" End If Instead of: CurrentDb.Execute "DELE...

Message reason why Execute method failed

I use the DAO method Execute to delete some records. If this fails this is clear by checking RecordsAffected (it will be 0). But is it possible to get the error message (for instance, to log or to show to the user)? I've try to delete the records by hand in the Table grid I get a clear dialog message, e.g. "The record cannot be deleted o...

Is automatic rollback of DAO integration tests with Spring Test a good practice?

If I were to annotate my DAO integration test methods with @Transactional, Spring Test will happily rollback any changes to the database after each test methods completes. These seems extremely convenient, because I can load the test data once with a @BeforeClass method and all clean up is handled for me. But I question whether this is...

Access as a front-end to SQL Server - ADO vs DAO?

I have a project that will be using Access 2003 as the font-end and the data being stored in SQL Server. Access will connect to SQL Server via linked tables with all the database logic (stored procedures, views) within SQL Server. Given this setup, would it be better to use ADO or DAO within Access? Is it just a matter of preference or ...

Designing DAOs around a JSON API for iPhone Development

So I've been trying to design a clean way of grabbing data for my models in iPhone land. All the data for my application is coming from JSON API's. So right now when a VC needs some models, it does the JSON call itself (asynch) and when it receives the data, it builds the models. It works, but I'm trying to think of a cleaner method whe...

Converting DAO to ADO

I am working with an Access 2003 database that has a subroutine using DAO code. This code loops through the table definitions and refreshes the ODBC connection string. I would like to convert this to ADO so I do not have to reference the DAO object library. Here is the code ... Public Sub RefreshODBCLinks(newConnectionString As String) ...