I am creating the model for a web application. The tables have ID fields as primary keys. My question is whether one should define ID as a property of the class?
I am divided on the issue because it is not clear to me whether I should treat the object as a representation of the table structure or whether I should regard the table as a m...
Trying to map the following schema using the Entity Framework.
A Customer can have many associated Stores.
A Store can have many associated Customer
Each Store can have 0 or 1 and only 1 TopCustomer (the criteria to be a TopCustomer is determined in the business logic)
this results with the following mapping in VS.
Her...
I'm working on a backend for an open source Python ORM. The library includes a set of 450 test cases for each backend, all lumped into one giant test class.
To me, that sounds like a lot for one class, but I've never worked on a project that has 450 test cases (I believe this library has ~2000 test cases not including the test cases fo...
I have the following code to put all my users from a multichoice field into a list
USERS = []
for user in User.objects.filter(groups__name='accountexec'):
USERS.append((user.id,user))
I need to use Log.objects.filter() to get all the logs with a user= to a user in the USERS list
...
I have a legacy object model that has content objects and a table designed to express relationships between content objects. The latter is called a content_content_connections table, and in addition to having the primary key of the from and to content, it also contains 3 other fields. A connection type field, and content type id fields...
I'm looking to expand my ruby knowledge beyond scripting, test code and file parsers by writing some web services. I'm thinking of using sequel as an ORM.
What advantages are there to using Sequel Core or Sequel Model? What should I be looking out for? What rules of thumb are there for picking one or the other?
...
Here's what I have, which has problems:
public User addUser(final String name, final String uid) {
final List<User> result = findByProperty("uid", uid);
if (!result.isEmpty())
return (result.get(0));
final User user = new User(name, uid);
saveOrUpdate(user);
return (user);
}
where findByProperty is usin...
I've recently started to fell in love with SQLAlchemy. You can write clean and fast SQL statements without having to write one line of SQL. There is no need to write most of the meta configuration you would need for something like Hibernate. At work I managed to create a mapper for a table which doesn't have a primary key! I can have com...
Maybe I should first give an idea of what I want to accomplish as there might be a much better solution.
I have a web application using Django that manages media (Recorded TV, movies, etc). The web app allows you to add meta data to the media such as what you have watched on a per user basis and allows you to perform searches and synchr...
Hi
I have 2 models
I use this models to show the avatar in comments.
django_comments:
user_id
comment
.....
myapp_profile
user_id
image_path
......
Actually i´m doing a raw query with cursor.execute(), to get this data
------- ---------- -------
'user_id' 'image_path' 'comment'
------- ---------- -------
...
I'm having trouble understanding how to use ORM generated objects. We're using LLBLGen for mapping our database model to objects. These objects we encapsulate in another layer which represents our business model(I think).
Maybe this bit of code will explain this better.
public class Book { // The class as used in our application
pr...
So, a simple question. First, I did read this StackOverflow question, so no need to point me towards it.
I'm working on a similar problem right now. Specifically, I have a database with an Auditing table that is used to store auditing info about other tables within the db. The basic form of this table is:
ID, EntityID, EntityTypeID, Ac...
I am wondering how the shift from relational, table-based design to object-oriented, entity-based design is affecting the mindset of developers writing the next wave of applications.
Given the nature of the debate swirling around the Entity Framework and Linq to SQL, is it premature to be thinking about entity-driven design?
Are we bri...
I would like to write a hql query using a dynamic instantiation with a list as one of it's parameters.
Simplified example:
A HQL query with a dynamic instantiation:
select new x.y.UserDto(u.name, u.contacts) from User u where u.xyz=:param1 ...
and my dto class constructor is:
public class UserDto {
private String name;
privat...
I was trying to do something that apparently doesn't work in JPQL:
JPQL:
select c from Car c
left join fetch c.owner
where c.type in (?1)
order by c.model
Code:
public List<Car> findCarsFilterByTypes(CarType[] types) {
return (List<Car>) this.entityManager.createNamedQuery("dealership.findCarsFilterByType...
Are there any alternatives to sequel orm when working on Sinatra based app
...
How can you add greater than or less than symbols to the condition on a Hibernate filter specified in the hbm.xml file?
I am trying to add a filter to limit the collection to a specific date range:
<filter name="limitTalksByDateRange" condition="talkstart >= :tstart and talkstart <= :tend" />
Unfortunately this breaks the XML parsing...
Hi all,
Starting up a new project it is 100% new development against a very large (300 tables) legacy database. The database does not match up all that well to the business model so my initial thoughts where to use a ORM.
I got a proof of concept working with NHibernate pretty well... but got A LOT of management push back on the use ...
I am a PHP developer and I am familiar with ORM (Doctrine and Propel), but I seldom heard about DAO. What are the differences and relationship between ORM and DAO from PHP development perspective?
If I use Symfony to develop very large and complex projects, will that be better if I use DAO? (ORM is somehow heavy I think, but I know lit...
In the Zend Framework Quickstart, there has been a change from models that extend Zend_Db_Table_Abstract to the Table Data Gateway pattern.
Personally, I have not had much experience with this pattern and I keep hearing this should most likely be used instead of the old way.
A short example from the quickstart:
Old way:
class Default...