dao

Spring MVC Domain Object handling Best Practice

Lets assume a simple Spring MVC Controller that receives the ID of a domain object. The Controller should call a service that should do something with that domain object. Where do you "convert" the ID of the domain object into the domain object by loading it from the database? This should not be done by the Controller. So the service m...

What is the difference between DAO and DAL?

Having studied Java at school I am quite familiar with the DAO-pattern(Data access object). However at work I use .NET. In .NET there is often talk about the DAL(Data Access Layer). To me their purpose seems quite similar. So the question is are DAO and DAL basically the same thing? Is the term DAL only made up so it wouldn't be mixed up...

Is using synchronized on a Java DAO going to cause issues?

Is using the 'synchronized' keyword on methods in a Java DAO going to cause issues when used by a web application? I ask because I have a multi-threaded stand alone application that needs the methods to by synchronized to avoid resource conflict, as seen here. java.util.concurrent.ExecutionException: javax.persistence.PersistenceExcept...

Spring DaoSupport and @PersistanceContext EntityManager?

One of the most difficult things about understand Spring is that Spring supports multiple approaches to the same problem. So in my application I using injected EntityManager using the @PersistanceContext annotation, for example: @Repository public class JpaDao extends JpaDaoSupport implements Dao { @PersistenceContext(unitName = "...

Change DAO DBEngine DataTable's column from DataType dbInteger to dbLong in VB6

I've inherited a legacy VB6 app to maintain, and my vb6 is more than a little rusty... I've got a DAO Table that had a field of type DAO.DataTypeEnum.dbInteger that needs to be altered to type DAO.DataTypeEnum.dbLong. Is there a shortcut vb6 way of setting this new data type and retaining the existing values, or do I need to create a t...

Hibernate multi level of transaction

hi every one, I have some hibernate code and I want my code run in 1 transaction let me explain in code public void changeBranch(Branch branch) throws DatabaseException { //some code humanDao.update(he); superBranchUsername = branch.getFatherUsername(); int superBranchId = branchDao.getBranchIdByUserN...

Access 2007 DAO VBA Error 3381 causes objects in calling methods to "break".

---AFTER FURTHER INVESTIGATION--- "tblABC" in the below example must be a linked table (to another Access database). If "tblABC" is in the same database as the code then the problem does not occur. Hi, We have recently upgraded to Office 2007. We have a method in which we have an open recordset (DAO). We then call another sub (Updati...

How can I switch an Access database between shared and exclusive mode?

I'm working on a program that needs to edit some objects in an Access database. It also runs a subprogram (long story) that tries to access the underlying JET database while Access still has it open via ODBC. The problem is that as soon as I start editing Form objects using VBA - for example, using Application.LoadFromText - Access cha...

Accessing Field2 in Access 2007

I'm trying to write a simple little routine to email an attachment stored in an Access 2007 database. For some reason I cannot get the simplest part of it to work. I get an error saying "User-defined type not defined" on the following line: Dim attachmentField As DAO.Field2 Now up to this point I haven't accessed any DAO objects yet,...

Strange field assignment issue in DAO with Access 2007

This is a follow-up on my previous question. Once I got the problem with the reference sorted out, I ran into another pretty strange issue. Basically, I have the following behind a button on a form: Dim attachmentField As DAO.Field2 attachmentField = Recordset("Att") I have now linked the reference, placed a break point on the secon...

One big DAO or multiple smaller ones?

If I have to save an object to the database which has a relationships, do I have that dao do all the saving itself, or to delegate to other DAO's. If it should delegate to other DAOs, should that be done in the DAO itself, or in a layer above (like a service layer)? I would use an ORM for this, except that in PHP, nothing good exists yet...

Get annoted hibernate tablename from POJO

Hi guys, I have an entity which is declared roughly like: @Entity @Table(name = "myUserTable") public class User implements Serializable { ... } I'm making a generic DAO class, and in doing so I'd like to retrieve the "myUserTable" name. Is there any way I can reach this name? Cheers Nik ...

Why put a DAO layer over a persistence layer (like JDO or Hibernate)

Data Access Objects (DAOs) are a common design pattern, and recommended by Sun. But the earliest examples of Java DAOs interacted directly with relational databases -- they were, in essence, doing object-relational mapping (ORM). Nowadays, I see DAOs on top of mature ORM frameworks like JDO and Hibernate, and I wonder if that is really a...

Accessing the JDBC ResultSet concurrently in Spring

I am processing a large amount of data in a Spring JDBC DAO. The DAO directly returns an Iterator over the objects which operates on a bounded BlockingQueue using take() while the retrieval operation is happening in a separate thread (using an ExecutorService). Inside this thread I see the following behaviour: the retrieval works but ce...

Executing queries using DAO

I want to execute a list of queries against an Access database using DAO. The "Database.Execute()" method seems suited for this with the remark that it can only execute "action queries", that is queries which don't return a result set (MSDN reference). For queries which return records "Database.OpenRecordset()" can be used. Both methods ...

OOP DAO design question

Quick background: I'm programming in PHP, I have a domain model with a separate data access layer (DAO classes) that are responsible for fetching data from the DB and creating domain classes. Let's say I have a DAO class responsible for creating group and groupList objects. You can imagine the groups as a component of a social network; ...

C# and DAO. Why RS.Fields("ColName") doesn't work ?

dao.DBEngine DBE; dao.Database DB; dao.Recordset RS; string DBPath; DBPath = "C:\\Test\\test.mdb"; DBE = new dao.DBEngine(); DB = DBE.OpenDatabase(DBPath, false, false, ""); RS = DB.OpenRecordset("SELECT * FROM TEST", dao.RecordsetTypeEnum.dbOpenSnapshot, 0, dao.LockTypeEnum.dbOptimistic);...

Jet error 3011 when opening a file with 2 "extensions"

I'm having a problem with Jet throwing error 3011 when I try to use it to open a file with 2 "extensions" ("filename.tst.csv"). Run-time error '3011' The Microsoft Jet database engine could not find the object 'filename.tst.csv'. Make sure the object exists and that you spell its name and the path name correctly. Where the cod...

How to open Excel 2007 (xlsx) file with CDaoDatabase

Using CDaoDatabase defined in afxdao.h, how can I open up Excel 2007 (xlsx) files? I can open up Excel 2003 (xls) files using the connection string Excel 8.0;HDR=NO;IMEX=1, anybody know how I can do this? Thanks! ...

Wizard-generated JPA DAO method doesn't return an iterable List

I must be really stupid, but I'm at my wits' end with a JPA issue, using MyEclipse 7.5. I am accessing a DB2 database (on an AS400) via JPA. I have reverse-engineered a simple table to provide a DAO with some precision "find" methods. So far so good. If I run a SELECT statement over the table thus, I get 4 rows: SELECT * FROM MyTable ...