orm

Storing a Map<String,String> using JPA

I am wondering if it is possible using annotations to persist the attributes map in the following class using JPA2 public class Example { long id; // .... Map<String, String> attributes = new HashMap<String, String>(); // .... } As we already have a pre existing production database, so ideally the values of attributes ...

Zend Form : Validate a set of fields / group of fields

Is there any good solution for the following requirement: An Form with one field for the zip code and default validators like (number, length 4..). After submit, the form is checked against an database. If the zip code is not unique we have to ask for an city. Examples Case 1: Submited zip code is unique in database : everything o...

Kohana "has many through" relation

Hi, I was wondering what the best method is to edit a 'has many through' relation with a form. Let's say I have a bunch of users that can belong to multiple categories. The form would have some checkboxes like this: <input type="checkbox" name="category_ids" value="1" /> <input type="checkbox" name="category_ids" value="2" /> Th...

Is this the right way of using ThenFetch() to load multiple collections?

I'm trying to load all the collections eagerly, using NHibernate 3 alpha 1. I'm wondering if this the right way of using ThenFetch()? Properties with plural names are collections. The others are just a single object. IQueryable<T> milestoneInstances = Db.Find<T, IQueryable<T>>(db => from mi in db whe...

What are Disconnected ORM and Connected ORM

Hi , Could any body clarify these two expression for me ? What are cons and pros of each one ? // I've just worked and familiar with CodeSmith and Linq to sql among all ORM Tools Thank you ...

ORM and NH for business people

I have to prepare a case to convince managers to promote development using an ORM. I don't want to go into technical details in this case, the benefits have to be visible to business people. I'm not quite happy with the arguments I've written down until now Are there any points I'm forgetting, both PRO and CONTRA? The case I'm going to...

DBLinq for a production system?

We're working on an ASP.NET web application with C# code behind. The database is MySQL 5.1 using InnoDB. The data access layer uses ADO.NET to call stored procedures and then builds various data structures out of the result sets (no object mapping). This works fine, but it is a little verbose. Not surprisingly, we made some mistakes ...

What happens to dereferenced hibernate (JPA) entities?

In a project i am working on, we have an EJB backend where various clients connect remotely (i.e. Web layer, web services layer, etc). The clients are on another machine and can be in another data center, so the front end and backend are never in the same app server. The backend is layered as follows: SLSB <-> Service Layer Objects <-...

Data Mapper for Child Objects

Hello, Assume we have a Customer class which has a complex property called Address. Something like this: public class Customer { public string Name { get; set; } public Address { get; set; } } I need to implement Data Mapper pattern to persist Customer objects to the database. Should I have something like CustomerDataMapp...

Choice of OR Mapper for a new project

Hello! We are about to start a new project. It will be a group of web aplications with a good number of shared components. It will have up to 50.000 unique users visits per day and It will be some kind of management panel. All projects will be build in asp.net mvc 2 and they will all work on the one SQL Server database. We've been very...

entity manager merge method to update blob field

public void uploadFile(ActionEvent evt)throws Exception{ InputFile inputFile=(InputFile)evt.getSource(); byteArrayOutputStream=new ByteArrayOutputStream(); ObjectOutputStream objectOutputStream=new ObjectOutputStream(byteArrayOutputStream); objectOutputStream.writeObject(inputFile.getFile()); reportTemplate.setTemplatePa...

Hibernate : dynamic-update dynamic-insert - Performance Effects

Hi, Using dynamic-update or dynamic-insert has positive, though generally slight only on performance, as also mentioned by http://www.mkyong.com/hibernate/hibernate-dynamic-update-attribute-example/ But the reference documentation mentions that this could have negative performance effects also as mentioned below in http://docs.jboss.or...

Multiple unique constraints in JPA

Is there a way to specify using JPA that there should be multiple unique constraints on different sets of columns? @Entity @Table(name="person", uniqueConstraints=@UniqueConstraint(columnNames={"code", "uid"})) public class Person { // Unique on code and uid public String code; public String uid; // Unique on us...

django subquery via orm

I have models: class Site(models.Model): profile = models.ForeignKey(User) class Profile(models.Model): blacklist = models.ManyToManyField(Site) How can i do equivalent of this query via django orm? SELECT * FROM site WHERE 2 NOT IN (SELECT site_id FROM profile_blacklist WHERE profile_site.profile_id=site.profile_id) I nee...

Specifying an index (non unique key) using JPA

How do you define a field, ie email as having an index using JPA annotations. We need a non-unique key on email because there are literally millions of queries on this field per day, and its a bit slow without the key. @Entity @Table(name="person", uniqueConstraints=@UniqueConstraint(columnNames={"code", "uid"})) public class Pe...

doctrine query for chained one-to-many relationships

I have three tables A, B, C. A and B have a one-to-many relationship. B and C have another one -to-many relationship. In another word, each A can have multiple Bs, while each B can have multiple Cs. Now I want to do a query for a given record of A, to get all the related Bs which have related Cs. In another word, for a given a, which is...

JPA left join to find unused entries

I'm sure I'm being stupid but I can't seem to figure this one out... I have two tables: department( did, name ) employee( eid, first, last, did ) they have corresponding entities JPA managed entites Department and Employee. Employee has a Deparment field, Department doesn't maintain an Employee list. What I want to do though is find a...

If Entity Framework is meant to work with POCOs, then why the dependency on IObjectSet?

I keep hearing about EF 4.0, POCO, IObjectSet, UnitOfWork (by the way, UoW is atleast more than 17 years old when I first heard it) etc. So some folks talk about Repository "pattern". etc. There are numerous bloggers showcasing their concoction of a "wrapper" or repository or something similar. But they all require IObjectSets (or in so...

JPA: When parent entity got removed, child entity still remain

Customer Entity (Parent Entity) @Entity public class Customer { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String name; @OneToMany(mappedBy="customer", cascade=CascadeType.ALL) private List<Facility> facilities; //Setter and Getter for name and facilities public void addFacility(Facility facility){...

Multiple Linq data models with the same table being mapped in each Re-use mapping

I've implemented the repository pattern on the data access layer of our current service layer. We have an object model where the same class "historical notes" is mapped on mutiple objects (currently 6 but soon to be more!) Part of the best practices for the use of linq to sql is not to have one dbml file for every table in the db, but ...