orm

PHP Doctrine ORM newbie - Valid DSN for dropping database?

Hi, I'm going through the tutorials for doctrine and liking it so far, however I'm stuck at the point of dropping/regenerating the db schema. This is the code I am using (pretty much straight from the tutorial) require_once(dirname(__FILE__) . '/lib/vendor/doctrine/Doctrine.php'); spl_autoload_register(array('Doctrine', 'autoload')); $...

When should one avoid using NHibernate's lazy-loading feature?

Most of what I hear about NHibernate's lazy-loading, is that it's better to use it, than not to use it. It seems like it just makes sense to minimize database access, in an effort to reduce bottlenecks. But few things come without trade-offs, certainly it slightly limits design by forcing you to have virtual properties. But I've also ...

Convert date to string upon saving a doctrine record

Hi, I'm trying to migrate one of my PHP projects to Doctrine. I've never used it before so there are a few things I don't understand. In my current code, I have a class similar to this: class ScheduleItem { private Date start; //A PEAR Date object. private Date end; public function getStart() { return $this->start; } public...

How are Models (in MVC) and DAOs supposed to interact?

How are models and DAOs supposed to interact? I'm in the process of putting together a simple login module and I'm unsure where to put the "business logic." If I put the logic with the data in the model, how would I access the logic? Currently, I have: A controller that receives form data A model that is a simple reflection of...

Is there a better, more "Standard" way to perform SQL queries in PHP without using a framework?

For the longest time, I've been using the following basic formatting for SQL queries within my PHP: $sql = "SELECT * FROM `user-data` WHERE `id` = '".$id."' LIMIT 1;"; $fn = mysql_fetch_assoc(mysql_query($sql)); While this works flawlessly, it can get really messy for longer bits of code, and something deep inside of my conscience cri...

Open Source Equivalents to Erwin

I am aware of CA/Erwin community edition but it is constrained to 25 objects. I have also tried modeling in Visio which was painful. Curious to learn of any open source equivalents that not only pictorially allow for relational modeling but can also generate DDL. ...

What ORM for .net should I use?

I'm relatively new to .NET and have being using Linq2Sql for a almost a year, but it lacks some of the features I'm looking for now. I'm going to start a new project in which I want to use an ORM with the following characteristics: It has to be very productive, I don't want to be dealing with the access layer to save or retrieve obje...

What OR-mappers allow one-to-many AND One-to-one relationship between the same tables?

Hi, I'm currently looking for an OR-mapper to use for a side project I'm about to start. Since we're using an inhouse developed OR-mapper at work I don't really know much about how other mappers work (and have a pretty incomplete picture of which exist). After some research it seems that NHibernate, Linq-to-SQL and Entity Framework are ...

Django: Filter rows containing a set of values in ManyToManyField

I have the following model: class Channel(models.Model): tags = models.ManyToManyField(Tag) class Tag(models.Model): name = models.CharField( primary_key = True) And want to get_or_create a channel that has exactly the given set of tags. tags = map(lambda x: Tag.objects.get(name = x), ['tag1', 'tag2']) channel = Channel.obje...

Nhibernate subclass mapping problem

I am using nhibernate subclass mapping to handle descriptions of objects of the system. Basically idea is to have a description class and make polymorphic associations by having sub classes specific to the object. My code inserts the description data correctly to the Database; that means the ownerid and ownertype columns are created corr...

Creating a file upload template in Doctrine ORM

Hey all. I'm using Doctrine 1.2 as my ORM for a Zend Framework Project. I have defined the following Model for a File. File: columns: id: primary: true type: integer(4) unsigned: true code: type: string(255) unique: true notblank: true p...

Value object or entity object in my Hibernate mapping?

Hey everyone, I'm trying to design a pretty simple app and am getting myself a bit confused with Hibernate's definition of entity and value objects (as defined in Chapter 4 of Java Persistence with Hibernate). What I have is an app with customers, who can place orders (one to many relationship). Each of these orders has many order line...

Generated Doctrine models respect case, but generated Yaml does not

Just getting started with Doctrine ORM for PHP (v1.1.5) and ran into something unexpected. I am generating models from the db (MySQL 4) using: Doctrine::generateModelsFromDb($pathToModels); Then generating YAML from the models using: Doctrine::generateYamlFromModels($pathToSchema . '/schema.yml', $pathToModels); In the generated m...

monitoring mysql for changes

I have a Java app using a MySQL database through hibernate. The database is really used as persistence layer: The database is read at the initial load of the program, and the records are then maintained in memory. However, we are adding extra complexity, where another process may change the database as well, and it would be nice for t...

Database neutral .NET application

Many product developers want to write a .NET application which will work seamlessly with any popular RDBMS like SQL server, oracle, DB2 , MySql. If we use the Data application block it dynamically picks the database driver (OracleClient, SQLClient or OleDBClient) based on configuration. However, all databases have their own flavours of...

How to generate BlToolkit model

From what I have seen on the ormbattle.net, BlToolkit is the fastest ORM for .NET. I would like to test it in one of my projects, but I don't know how to generate entity classes. Should I do this by hand? I have 20+ tables in the database. Is there any online tutorial or blog, where I can find more information about BlToolkit? It looks ...

I Want to get a week value

I wan to get the value of only one week. I am using the following JPA query: SELECT a FROM questions.dao.hibernate.Questions a WHERE (a.posted_date-CURRENT_DATE)>= 7 But I am getting an error message like org.hibernate.QueryException: could not resolve property: posted_date of: questions.dao.hibernate.Questions [SELECT a FROM qu...

SQL 2008 - Foreign key constraints in the INFORMATION_SCHEMA view

Hi, I am writing a c# unit test that validates string properties for an ORM class against the target database, always SQL 2008, and the class that the data maps to. Checking that a specified foreign key is valid in the DB is easy: static private bool ConstraintExsits(string table, string column, ConstraintType constraintType) ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the tables are in the same database, then everything works fine. ...

How to update a specific fields of class in Fluent NHibernate with out updating the whole object?

Hi, I am using Fluent NHibernate to do my NHibernate mappings, but now I have come to a problem that I am not sure how to solve. A simplified version of the problem follows. I have a user class: public class User { public virtual int Id { get; set; } public virtual string FirstName { get; set; } public virtual string Last...