Search Results

Search found 2080 results on 84 pages for 'micro orm'.

Page 6/84 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Django ORM QuerySet intersection by a field

    - by Sri Raghavan
    These are the (pseudo) models I've got. Blog: name etc... Article: name blog creator etc User (as per django.contrib.auth) So my problem is this: I've got two users. I want to get all of the articles that the two users published on the same blog (no matter which blog). I can't simply filter the Article model by both users, because that would yield the set of Articles created by both users. Obviously not what I want. but can I filter somehow to get all of the articles where a field of the object matches between the two querysets?

    Read the article

  • ORM: why should i use it?

    - by Cris
    Hello, i develop since many years in SQL (many different sql servers like Oracle, MSSql, Mysql) and i always been happy in doing that. I've recently seen a lot of stuff around ORMs and i'm asking why should i move toward this world. Can you give me some good points for spending time in learning a different way to do what i already do today? Thanks in advance c.

    Read the article

  • Exclude rows with Doctrine ORM DQL (NOT IN)

    - by Sheriffen
    I'm building a chat application with codeigniter and doctrine. Tables: - User - User_roles - User_available Relations: ONE user have MANY roles. ONE user_available have ONE user. Users available for chatting will be in the user_available table. Problem: I need to get all users in in user_available that hasn't got role_id 7. So I need to express in DQL something like (this is not even SQL, just in words): SELECT * from user_available WHERE NOT user_available.User.Role.role_id = 7 Really stuck on this one EDIT: Guess I was unclear. The tables are already mapped and Doctrine does the INNER JOIN job for me. I'm using this code to get the admin that waited the longest but now I need the user: $admin = Doctrine_Query::create() ->select('c.id') ->from('Chat_available c') ->where('c.User.Roles.role_id = ?', 7) ->groupBy('c.id') ->orderBy('c.created_at ASC') ->fetchOne(); Now I need to get the user that waited the longest but this does NOT work $admin = Doctrine_Query::create() ->select('c.id') ->from('Chat_available c') ->where('c.User.Roles.role_id != ?', 7) ->groupBy('c.id') ->orderBy('c.created_at ASC') ->fetchOne();

    Read the article

  • Dealing with uncertainty in ORM - Entity Framework CodeOnly

    - by Simon Fox
    This is a bit of a strange one but I've just seen something on twitter which kind of baffled me and I'm interested to know more. Rob Conery tweeted the following a couple of hours ago: Class name of the day: "Maybe<T>". Method of the day: "ToMaybe<T>()". He then went on to offer a Tekpub coupon to anyone who could guess where it came from. He linked to a further tweet which had a clue and from that I worked out that it was Entity Framework Code-Only but while trying to determine the usage someone else answered to which Rob replied ...EF CodeOnly - dealing with uncertainty.... So my question boils down to what exactly is he referring to with uncertainty and how does this fit in to Entity Framework Code-Only?

    Read the article

  • General ORM design question

    - by Calvin
    Suppose you have 2 classes, Person and Rabbit. A person can do a number of things to a rabbit, s/he can either feed it, buy it and become its owner, or give it away. A rabbit can have none or at most 1 owner at a time. And if it is not fed for a while, it may die. Class Person { Void Feed(Rabbit r); Void Buy(Rabbit r); Void Giveaway(Person p, Rabbit r); Rabbit[] rabbits; } Class Rabbit { Bool IsAlive(); Person pwner; } There are a couple of observations from the domain model: Person and Rabbit can have references to each other Any actions on 1 object can also change the state of the other object Even if no explicit actions are invoked, there can still be a change of state in the objects (e.g. Rabbit can be starved to death, and that causes it to be removed from the Person.rabbits array) As DDD is concerned, I think the correct approach is to synchronize all calls that may change the states in the domain model. For instance, if a Person buys a Rabbit, s/he would need to acquire a lock in Person to make a change to the rabbits array AND also another lock in Rabbit to change its owner before releasing the first one. This would prevent a race condition where 2 Persons claim to be the owner of the little Rabbit. The other approach is to let the database to handle all these synchronizations. Who makes the first call wins, but then the DB needs to have some kind of business logics to figure out if it is a valid transaction (e.g. if a Rabbit already has an owner, it cannot change its owner unless the Person gives it away). There are both pros/cons in either approach, and I’d expect the “best” solution would be somewhere in-between. How would you do it in real life? What’s your take and experience? Also, is it a valid concern that there can be another race condition the domain model has committed its change but before it is fully committed in the database? And for the 3rd observation (i.e. state change due to time factor). How will you do it?

    Read the article

  • Codeigniter php activerecord orm limit and offset

    - by user2167174
    I am a bit stuck with this problem I have in phpactiverecord. What I am trying to do is a pagination so I need to limit and offset the query results. I am accessing all of the user posts like so: $user-post; How can I query this to limit and offset the results? Thanx in advance. Code: public function office() { if (!$this->session->userdata('username')) { redirect(base_url()); } $data = array(); $data['posts'] = []; $user = User::find('first', array('id' => $this->session->userdata('id'))); if ($user != null) { if ($user->post != null) { foreach ($user->post as $post) { $posts = array($post->name, $post->description, $post->date,'<a href="'.base_url().'Posts/edit/'.$post->id.'">Edit</a> <br /><a href="'.base_url().'Posts/delete/'.$post->id.'">Delete</a>'); array_push($data['posts'], $posts); } $this->table->set_heading('Name', 'Description', 'Date', '<a href="'.base_url().'Posts/create">+Add</a>'); $tmpl = array('table_open' => '<table class="table table-stripped table-bordered user-posts">'); $this->table->set_template($tmpl); $data['table'] = $this->table->generate($data['posts']); } $this->load->view('template/header.php'); $this->load->view('Users/office.php', $data); $this->load->view('template/footer.php'); } else { redirect(base_url()); } }

    Read the article

  • How to dynamically change fields in an .NET ORM

    - by rsteckly
    I'm working in ASP.NET in an application where often users want to add fields or change field names. I'd like to be able to have an xml schema in place that is parsed and a dynamic object model created from it that can be accessed throughout the application. My initial reaction is that this is not realistic. I think there is flexibility about the dynamic nature of it. I think the people I'm trying to build this for wouldn't mind recompiling. Even if the app recompiled, I don't know how to abstract away enough in my code access the data to allow for users changing property names, etc. How can you write LINQ when the properties might change? In short, there's two questions here: 1) is there a way to dynamically generate an object model of the database and 2) is there a way to abstract away enough so that code accessing the database doesn't break when properties change?

    Read the article

  • PHP ORM's, multiple tables and efficiency

    - by sunwukung
    Let's say I have a data mapper function that aggregates multiple tables and generates an object instance from that data. The mapper has a typical save() method which delegates to update/insert. When the mapper executes save - ideally it isolates object fields that have been modified, thus preventing the code from blanket bombing the database. How would you go about this?

    Read the article

  • ORM Against a Service-Wrapped Data Source

    - by blaster
    We are tasked with migrating an existing set of entities (currently POCOs persisted with NHibernate against an MSSQL database) to now persist to some kind of web service (yet to be built, either RESTful or SOAP-based, and that we control). I like how NHibernate encapsulates the persistence concerns and lets us maintain a logic-rich, persistence-agnostic domain model. Is there any way to make NHibernate talk to a web service at the back end instead of a SQL database directly? In other words, can "service instead of SQL database" be treated as a persistence implementation detail and allow us to continue to use NHibernate? Am I asking the right question? :)

    Read the article

  • Define classes for a datatable structure - ORM

    - by user424493
    I have existing tables - I have following datatables : ActivityTable(Key ActivityId) - which lists the identifier for various activity ProcessTable (identified by ProcessId) - which lists down which activites(ActivityId) are to be carried out along with their order(StepNum). Some of the activities are marked constant with in a process, that is they will have same data, ir-respective of there run environment. RunTable(Key RunConfigurationId) - that identifies the project name and Process Id Then data for each activity is stored is stored in their individual tables Activity_A, Activity_B,Activity_C so on it uses a combination of RunConfigurationId,ProcessId and stepNum. For the activities which are constant we use a RunConfigurationId= -100. Can anybody help me out how I can map something like this in classes using inheritence regards

    Read the article

  • Django Querying Relation of Relation

    - by Brent
    I'm stuck on a Django ORM issue that is bugging me. I have a set of models linked by a foreign key but the requirements are a bit odd. I need to list items by their relation's relation. This is hard to explain so I've tried to depict this below, given: Work ManyToMany(Award) Award ForeignKey(AwardCategory) AwardCategory I need to list work items so they are listed by the award category. Desired output would be: Work Instance A Award Instance A that belongs to Award Category Instance A Award Instance C that belongs to Award Category Instance A Award Instance G that belongs to Award Category Instance A Work Instance A (same instance as above, but listed by different award__category) Award Instance F that belongs to Award Category Instance B Award Instance R that belongs to Award Category Instance B Award Instance Z that belongs to Award Category Instance B Work Instance B Award Instance B that belongs to Award Category Instance A Award Instance A that belongs to Award Category Instance A Essentially I want to list all work by the award category. I can get this to work in part but my solution is filthy and gross. I'm wondering if there is a better way. I considered using a ManyToMany and a through attribute but I'm not certain if I'm utilizing it correctly.

    Read the article

  • Building the Internet of Things – with Microsoft StreamInsight and the Microsoft .Net Micro Framework

    - by Roman Schindlauer
    Fresh from the press – The March 2012 issue of MSDN Magazine features an article about the Internet of Things. It discusses in depth how you can use StreamInsight to process all the data that is continuously produced in typical Internet of Things scenarios. It also gives you an end-to-end perspective on developing Internet of Things solutions in the .NET world, ranging from the .NET Micro Framework application running on the device, the communication between the devices and the server-side all the way to powerful cross-device streaming analytics implemented in StreamInsight LINQ. You can find an online version of the article here. Happy reading! Regards, The StreamInsight Team

    Read the article

  • JavaOne - Java SE Embedded Booth - Servergy Micro Server

    - by David Clack
    Hi All,  So it's been awhile, I've been working with all the ARM and Power Architecture partners we have now on testing Java SE Embedded. We will have a Java SE Embedded for ARM and PPC at Java One next week, I'll be bringing in some of the great ARM and PPC systems to demonstrate.  The first system I'd like to tell you about is a really cool 8 core Power Architecture Micro Server from a company in Dallas called Servergy. Java One will be it's first public outing, Bill Mapp the CEO will be doing a talk at the Java Embedded @ JavaOne conference in the Hotel Nikko, right next door to the JavaOne show in the Hilton. To read more about Servergy https://www.linux.com/news/enterprise/cloud-computing/641488-linux-based-servergy-advances-data-center-efficiency http://www.servergy.com/ If you are registered at JavaOne you can come over to the Java Embedded @ JavaOne for $100 Come see us in booth 5605 See you there Dave

    Read the article

  • Data Access Objects old fashioned? [on hold]

    - by Bono
    A couple of weeks ago I delivered some work for a university project. After a code review with some teachers I got some snarky remarks about the fact that I was (still) using Data Access Objects. The teacher in question who said this mentions the use of DAO's in his classes and always says something along the lines of "Back then we always used DAO's". He's a big fan of Object Relational Mapping, which I also think is a great tool. When I was talking about this with some of my fellow students, they also mentioned that they prefer the use of ORM, which I can understand. It did make me wonder though, is using DAO's really so old fashioned? I know that at my work DAO's are still being used, but this is due to the fact that some of the code is rather old and therefor can't be coupled with ORM. We also do use ORM at my work. Trying to find some more information on Google or Stack Exchange sites didn't really enlighten me. Should I step away from the use of DAO's and only start implementing ORM? I just feel that ORM's can be a bit overkill for some simple projects. I'd love to hear your opinions (or facts) about this.

    Read the article

  • Managing Kindle Fire with on 12.04 via Micro-USB

    - by pirtle
    To begin, I have read both Is there a way to get a Kindle Fire to work with 12.04? and How can I transfer files to a Kindle Fire with a Micro-USB cable? My problem is that I am unable to mount my Kindle Fire in order to add books to it. I have installed calibre, but it is unable to manage any devices until the computer itself has recognized it. The latter post had an excellent answer (provided by @jeremiah) that was making some progress. Unfortunately, I think I don't know enough about the -t flag used with mount. This is what I've done... Ran dmesg to locate the device: [ 3.920886] sd 6:0:0:0: [sdb] Attached SCSI removable disk Confirmed it's location: $ sudo ls -l /dev/disk/by-id lrwxrwxrwx 1 root root 9 Aug 18 15:52 usb-Amazon_Kindle_3C6C002600000001-0:0 -> ../../sdb So we know that my Kindle is recognized on /dev/sdb. I then used the mount command suggested by @jeremiah: $ sudo mount -t ext3 /dev/sdb/ /mnt/kindle/ mount: no medium found on /dev/sdb The same error occurs for sudo mount /dev/sdb /mnt/kindle. Note: I have created the 'kindle' directory in 'mnt' Any suggestions?

    Read the article

  • Kohana 3 ORM: How to get data from pivot table? and all other tables for that matter

    - by zenna
    I am trying to use ORM to access data stored, in three mysql tables 'users', 'items', and a pivot table for the many-many relationship: 'user_item' I followed the guidance from http://stackoverflow.com/questions/1946357/kohana-3-orm-read-additional-columns-in-pivot-tables and tried $user = ORM::factory('user',1); $user->items->find_all(); $user_item = ORM::factory('user_item', array('user_id' => $user, 'item_id' => $user->items)); if ($user_item->loaded()) { foreach ($user_item as $pivot) { print_r($pivot); } } But I get the SQL error: "Unknown column 'user_item.id' in 'order clause' [ SELECT user_item.* FROM user_item WHERE user_id = '1' AND item_id = '' ORDER BY user_item.id ASC LIMIT 1 ]" Which is clearly erroneous because Kohana is trying to order the elements by a column which doesn't exist: user_item.id. This id doesnt exist because the primary keys of this pivot table are the foreign keys of the two other tables, 'users' and 'items'. Trying to use: $user_item = ORM::factory('user_item', array('user_id' => $user, 'item_id' => $user->items)) ->order_by('item_id', 'ASC'); Makes no difference, as it seems the order_by() or any sql queries are ignored if the second argument of the factory is given. Another obvious error with that query is that the item_id = '', when it should contain all the elements. So my question is how can I get access to the data stored in the pivot table, and actually how can I get access to the all items held by a particular user as I even had problems with that? Thanks

    Read the article

  • How do I relate tables with different foreign key names in Kohana ORM?

    - by Matt H
    I'm building a Kohaha application to manage sip lines in asterisk. I'm wanting to use ORM but I'm wondering how do relate certain tables that are already well established. e.g. the table sip_lines looks like this. +--------------------+------------------+------+-----+-------------------+-----------------------------+ | Field | Type | Null | Key | Default | Extra | +--------------------+------------------+------+-----+-------------------+-----------------------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | sip_name | varchar(80) | NO | UNI | NULL | | | displayname | varchar(48) | NO | | NULL | | | line_num | varchar(10) | NO | MUL | NULL | | | model | varchar(12) | NO | MUL | NULL | | | mac | varchar(16) | NO | MUL | NULL | | | areacode | varchar(6) | NO | MUL | NULL | | | per_line_astpp_acc | tinyint(1) | NO | | 0 | | | play_warning | tinyint(1) | NO | | 0 | | | callout_disabled | tinyint(1) | NO | | 0 | | | notes | varchar(80) | NO | | NULL | | | last_update | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP | +--------------------+------------------+------+-----+-------------------+-----------------------------+ sip_buddies is this: +----------------+------------------------------+------+-----+-----------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------+------------------------------+------+-----+-----------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(80) | NO | UNI | | | | host | varchar(31) | NO | | | | | | | lastms | int(11) | NO | | 0 *** snip *** +----------------+------------------------------+------+-----+-----------+----------------+ The two tables are actually related as sip_lines.sip_name = sip_buddies.name How do I relate them in Kohana ORM as this wouldn't be quite right would it? <?php defined('SYSPATH') or die('No direct script access.'); /* A model for all the account information */ class Sip_Line_Model extends ORM { protected $has_one = array("sip_buddies"); } ?> EDIT: Actually, it'd be fair to say that these tables are not properly related with foreign keys! doh. EDIT: Looks like Kohana ORM is not that flexible. ORM is probably not the way to go and works best for completely new projects where the data model can be altered. The reason being that the key names must follow a specific naming convention or else they won't relate in Kohana.

    Read the article

  • Is ORM (Linq, Hibernate...) really that useful?

    - by Peter
    I have been playing with some LINQ ORM (LINQ directly to SQL) and I have to admit I like its expressive powers . For small utility-like apps, It also works quite fast: dropping a SQL server on some surface and you're set to linq away. For larger apps however, the DAL never was that big of an issue to me to setup, nor maintain, and more often than not, once it was set, all the programming was not happening there anyway... My, honest - I am an ORM newbie - question : what is the big advantage of ORM over writing a decent DAL by hand? (seems like a double, couldn't find it though) UPDATE : OK its a double :-) I found it myself eventually : ORM vs Handcoded Data Access Layer

    Read the article

  • Django aggregation query on related one-to-many objects

    - by parxier
    Here is my simplified model: class Item(models.Model): pass class TrackingPoint(models.Model): item = models.ForeignKey(Item) created = models.DateField() data = models.IntegerField() In many parts of my application I need to retrieve a set of Item's and annotate each item with data field from latest TrackingPoint from each item ordered by created field. For example, instance i1 of class Item has 3 TrackingPoint's: tp1 = TrackingPoint(item=i1, created=date(2010,5,15), data=23) tp2 = TrackingPoint(item=i1, created=date(2010,5,14), data=21) tp3 = TrackingPoint(item=i1, created=date(2010,5,12), data=120) I need a query to retrieve i1 instance annotated with tp1.data field value as tp1 is the latest tracking point ordered by created field. That query should also return Item's that don't have any TrackingPoint's at all. If possible I prefer not to use QuerySet's extra method to do this. That's what I tried so far... and failed :( Item.objects.annotate(max_created=Max('trackingpoint__created'), data=Avg('trackingpoint__data')).filter(trackingpoint__created=F('max_created')) Any ideas?

    Read the article

  • Should we have a database independent SQL like query language in Django?

    - by Yugal Jindle
    Note : I know we have Django ORM already that keeps things database independent and converts to the database specific SQL queries. Once things starts getting complicated it is preferred to write raw SQL queries for better efficiency. When you write raw sql queries your code gets trapped with the database you are using. I also understand its important to use the full power of your database that can-not be achieved with the django orm alone. My Question : Until I use any database specific feature, why should one be trapped with the database. For instance : We have a query with multiple joins and we decided to write a raw sql query. Now, that makes my website postgres specific. Even when I have not used any postgres specific feature. I feel there should be some fake sql language which can translate to any database's sql query. Even Django's ORM can be built over it. So, that if you go out of ORM but not database specific - you can still remain database independent. I asked the same question to Jacob Kaplan Moss (In person) : He advised me to stay with the database that I like and endure its whole power, to which I agree. But my point was not that we should be database independent. My point is we should be database independent until we use a database specific feature. Please explain, why should be there a fake sql layer over the actual sql ?

    Read the article

  • Telerik OpenAccess ORM and the XML Metadata Source

    We all know that Telerik OpenAccess ORM has a completely new face with the Q1 2010 release so it is about time to start blogging about some of the features and improvements that the new Visual Designer brought along.  Today I will talk about one of the most notable changes in the new version of OpenAccess ORM and that is the XML only mapping. You all know that so far with the previous versions of the product the mapping information was defined by a mix of XML configuration files and CLR attributes. After a lot of customer feedback and thorough thought we decided to make the XML and the attributes as two separate and self-contained sources of metadata information about your model. You can choose one based on your personal preferences. I will start with a brief overview over the new XML mapping definition. Unlike previous versions, where all ...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >