VBA – Run Time Error 3271 using DAO object

You’re facing a limitation of Access SQL text parameters. They can not accommodate string values longer than 255 characters. Here is a simple example which demonstrates the problem. Dim db As DAO.Database Dim qdf As DAO.QueryDef Dim strUpdate As String Dim strLongString As String strLongString = String(300, “x”) strUpdate = “UPDATE tblFoo SET memo_field = … Read more

Hibernate: CRUD Generic DAO

here’s mine @Component public class Dao{ @Resource(name = “sessionFactory”) private SessionFactory sessionFactory; public <T> T save(final T o){ return (T) sessionFactory.getCurrentSession().save(o); } public void delete(final Object object){ sessionFactory.getCurrentSession().delete(object); } /***/ public <T> T get(final Class<T> type, final Long id){ return (T) sessionFactory.getCurrentSession().get(type, id); } /***/ public <T> T merge(final T o) { return (T) sessionFactory.getCurrentSession().merge(o); … Read more

Enumerations in Hibernate

using hibernate or JPA annotations: class User { @Enumerated(EnumType.STRING) UserType type } UserType is just a standard java 5 enum. I can’t imagine this is just limited to just annotations but I don’t actually know how to do this with hbm files. It may be very version dependant, I’m guessing but I’m pretty sure that … Read more

What is the difference between the Data Mapper, Table Data Gateway (Gateway), Data Access Object (DAO) and Repository patterns?

Your example terms; DataMapper, DAO, DataTableGateway and Repository, all have a similar purpose (when I use one, I expect to get back a Customer object), but different intent/meaning and resulting implementation. A Repository “acts like a collection, except with more elaborate querying capability” [Evans, Domain Driven Design] and may be considered as an “objects in … Read more

What is the right way to use spring MVC with Hibernate in DAO, service layer architecture

IMHO the transactions should go to service layer. Typically one business transaction consists of several queries and updates. If you place @Transactional only on DAO layer, each query and update will run in a separate transaction, which effectively defeats the purpose of transactions. But if services are @Transactional, each database interaction joins one main transaction … Read more

Exporting MS Access Forms and Class / Modules Recursively to text files?

You can also try this code. It will preserve the items’ filetypes (.bas, .cls, .frm) Remember to refer to / Check the Microsoft Visual Basic For Applications Extensibility Library in VBE > Tools > References Public Sub ExportAllCode() Dim c As VBComponent Dim Sfx As String For Each c In Application.VBE.VBProjects(1).VBComponents Select Case c.Type Case … Read more