Search Results

Search found 7417 results on 297 pages for 'customer relationship'.

Page 31/297 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • Datamapper has n relationship with multiple keys

    - by jing
    I am working on a simple relationship with DataMapper, a ruby webapp to track games. A game belongs_to 4 players, and each player can have many games. When I call player.games.size, I seem to be getting back a result of 0, for players that I know have games associated with them. I am currently able to pull the player associations off of game, but can't figure out why player.games is empty. Do I need to define a parent_key on the has n association, or is there something else I'm missing? class Game belongs_to :t1_p1, :class_name => 'Player', :child_key => [:player1_id] belongs_to :t1_p2, :class_name => 'Player', :child_key => [:player2_id] belongs_to :t2_p1, :class_name => 'Player', :child_key => [:player3_id] belongs_to :t2_p2, :class_name => 'Player', :child_key => [:player4_id] ... end class Player has n, :games ... end

    Read the article

  • Relationship between .NET ClassLoader and Assembly

    - by smwikipedia
    I am wondering about the relationship between .NET ClassLoader and Assembly I use the "!dumpdomain xxxx" command and got the following output: Domain 1: 00522108 LowFrequencyHeap: 0052212c HighFrequencyHeap: 00522178 StubHeap: 005221c4 Stage: OPEN SecurityDescriptor: 00523430 Name: BoxUnbox.exe **Assembly**: 0056eb88 [C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll] **ClassLoader**: 0056ec08 SecurityDescriptor: 0056c078 Module Name 56d71000 C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll **Assembly**: 005794f0 [] **ClassLoader**: 00579570 SecurityDescriptor: 0057a018 Module Name 00152c5c I noticed that the "ClassLoader" and "Assembly" appear in pair. It seems each Assembly is accompanied with its own "ClassLoader". Why like this? Is this a litte noisy? Why not just assign one "ClassLoader" to a AppDomain and use it to load all the used Assembly into the AppDomain? Isnt't this design more elegant? Many thanks.

    Read the article

  • Database Instance

    - by Sam
    I read a statement from an exercise: construct a database instance which conforms to diagram 1 but not to diagram 2. The diagrams are different n-ary relationships that have different relationships. Diagram 1 has a many to one to many to one relationship. Diagram 2 has many to many to many to one relationship. So, to really understand this problem, what does a database instance mean? Is it to make an example or abstract entities like a1, a2, or a3. Thanks for your time.

    Read the article

  • Synonym for "Many-to-Many" relationship (relational databases)

    - by Byron
    What's a synonym for a "many-to-many" relationship? I've finished writing an object-relational mapper but I'm still stumped as to what to name the function that adds that relation. addParent() and addChild() seemed quite logical for the many-to-one/one-to-many and addSuperclass() for one-to-one inheritance, but addManyToMany() would sound quite unintuitive to an object-oriented programmer. addSibling() or addCousin() doesn't really make sense either. Any suggestions? And before you dismiss this as a non-programming question, please remember that consistent naming schemes and encapsulation are pretty integral to programming :)

    Read the article

  • rails override default getter for a relationship (belongs_to)

    - by brad
    So I know how to override the default getters for attributes of an ActiveRecord object using def custom_getter return self[:custom_getter] || some_default_value end I'm trying to achieve the same thing however for a belongs to association. For instance. class Foo < AR belongs_to :bar def bar return self[:bar] || Bar.last end end class Bar < AR has_one :foo end When I say: f = Foo.last I'd like to have the method f.bar return the last Bar, rather than nil if that association doesn't exist yet. This doesn't work however. The reason is that self[:bar] is always undefined. It's actually self[:bar_id]. I can do something naive like: def bar if self[:bar_id] return Bar.find(self[:bar_id]) else return Bar.last end end However this will always make a db call, even if Bar has already been fetched, which is certainly not ideal. Does anyone have an insight as to how I might have a relationship such that the belongs_to attribute is only loaded once and has a default value if not set.

    Read the article

  • Using a UIPickerView to make a CoreData Relationship

    - by DVG
    Okay, so I have a fairly simple application set up. I have two different CoreData Entities, Games and Platforms, each have one attribute: name, and they have a one-to-many relationship between them. Platforms are populated on the first launch of the application, and will never change as a result of user input. I'm working on my Add view to let the user add new games to their personal database, and each game should select from a platform. The add view itself is a grouped table view with static custom cells. Tapping the platform cell should advance the user to another view to select the platform. My thought is that UIPickerView seems like a logical choice for the control, since the Platform list is static, but I'm not sure how to use it with CoreData. Even if I construct a fetch request to get the Platform objects and extract the strings out, how do I go about linking the new Game object to the original Platform object?

    Read the article

  • How do I Relate these 4 Tables

    - by Baddie
    Trying to setup a simple Thread/Poll table mapping. Here is what I have: Threads table ThreadID (Primary Key/Identity Column) Polls table PollID (Primary Key, FK for ThreadID for one-to-one relation) Question PollOptions table PollOptionID (Identity/Primary Key) Text PollID PollVotes table PollVoteID (Primary Key/Identity) PollOptionID I'm not sure if this is a proper relationship. It seems wrong but I'm not sure whats wrong with it. A Thread can have 0 or 1 Poll. A Poll can have 2 or more PollOptions. A PollOption can have 0 or many PollVotes. I'm going to be using Entity Framework and before I generate the code for it (VS 2010, .NET 4) I want to make sure I have the proper relationship mapping.

    Read the article

  • Rails AR validates_uniqueness_of against polymorphic relationship

    - by aaronrussell
    Is it posible to validate the uniqueness of a child model's attribute scoped against a polymorphic relationship? For example I have a model called field that belongs to fieldable: class Field < ActiveRecord::Base belongs_to :fieldable, :polymorphic => :true validates_uniqueness_of :name, :scope => :fieldable_id end I have several other models (Pages, Items) which have many Fields. So what I want is to validate the uniqueness of the field name against the parent model, but the problem is that occasionally a Page and an Item share the same ID number, causing the validations to fail when they shouldn't. Am I just doing this wrong or is there a better way to do this?

    Read the article

  • NHibernate ManyToMany Relationship Cascading AllDeleteOrphan StackOverflowException

    - by Chris
    I have two objects that have a ManyToMany relationship with one another through a mapping table. Though, when I try to save it, I get a stack overflow exception. The following is the code for the mappings: //EventMapping.cs HasManyToMany(x => x.Performers).Table("EventPerformer").Inverse().Cascade.AllDeleteOrphan().LazyLoad().ParentKeyColumn("EventId").ChildKeyColumn("PerformerId"); //PerformerMapping.cs HasManyToMany<Event>(x => x.Events).Table("EventPerformer").Inverse().Cascade.AllDeleteOrphan().LazyLoad().ParentKeyColumn("PerformerId").ChildKeyColumn("EventId"); When I change the performermapping.cs to Cascade.None() I get rid of the exception but then my Event Object doesn't have the performer I associate with it. //In a unit test, paraphrased event.Performers.Add(performer); //Event eventRepository.Save<Event>(event); eventResult = eventRepository.GetById<Event>(event.id); //Event eventResult.Performers[0]; //is null, should have performer in it How should I be writing this properly? Thanks

    Read the article

  • Silverlight error-handling conventions: There is no relationship between onSilverlightError and Repo

    - by rasx
    When I see the call System.Windows.Browser.HtmlPage.Window.Eval (which is evil) in ReportErrorToDOM (in App.xaml.cs) this shows me that it has no relationship to onSilverlightError. So what kind of JavaScript-based scenario calls onSilverlightError? When will onSilverlightError definitely be needed? What are Silverlight error-handling conventions in general? This is a very important comment by Erik Monk but needs more detail: There are 2 kinds of terminal errors in Silverlight. 1) Managed errors (hit the managed Application_UnhandledException method). Note that some errors may not even get to this point. If the managed infrastructure can't be loaded for some reason (out of memory error maybe...), you won't get this kind of error. Still, if you can get it, you can use a web service (or the CLOG project) to communicate it back to the server. 2) Javascript errors.

    Read the article

  • SQL: many-to-many relationship, IN condition

    - by Maarten
    I have a table called transactions with a many-to-many relationship to items through the items_transactions table. I want to do something like this: SELECT "transactions".* FROM "transactions" INNER JOIN "items_transactions" ON "items_transactions".transaction_id = "transactions".id INNER JOIN "items" ON "items".id = "items_transactions".item_id WHERE (items.id IN (<list of items>)) But this gives me all transactions that have one or more of the items in the list associated with it and I only want it to give me the transactions that are associated with all of those items. Any help would be appreciated.

    Read the article

  • validates_uniqueness_of with HABTM relationship

    - by jeffshantz
    I've got a HABTM relationship between two models: Publication and Author. I want to ensure that one cannot create a publication with the same title, year, and author list. However, if I try something like this: class Publication < ActiveRecord::Base validates_uniqueness_of :title, :scope => [:year, :authors] end This obviously won't work since there is no authors column. Can this be done with validates_uniqueness_of, or do I need a custom validator? Thank you.

    Read the article

  • has_many through a habtm relationship in Rails

    - by macek
    I'm trying to define a has_many X, :through => Y where Y is a habtm relationship. Rails is throwing a fit about this. See comment in user model: class User < ActiveRecord::Base has_many :posts # I want to display a list of all tags this user is involved in has_many :tags, :through => :posts # ERROR end class Post < ActiveRecord::Base has_and_belongs_to_many :tags end class Tag < ActiveRecord::Base has_and_belongs_to_many :posts end What can I do to fix this?

    Read the article

  • Core Data Relationships in pre-populated SQLite database

    - by Cardinal
    Hi All, I'm new to Core Data. Currently I have following tables on hand: tbl_teahcer tbl_student tbl_course tbl_student_course_map ----------- ----------- ---------- ---------------------- teacher_id student_id course_id student_id name name name course_id teahcer_id And I'm going to make the xcdatamodel as below: Course Teacher ------ ------- name name teacher <<----------> courses students <<---| | Student | ------- | name |----->> courses My questions are as follows: As I'd like to create TableView for Cource Entity, is it a must to create the Inverse Relationship from Teacher to Course, and Student to Course? What is the beneit for having the Inverse Relationship? I got some pre-defined data on hand, and I'd like to create a SQLite storage for pre-populated source. How can I set up the relationships (both directions) in SQLite? Thank you for your help! Regards, Cardinal

    Read the article

  • Cannot set g:checkbox to off for a child on one-to-many relationship

    - by icon911
    Got a weird issue with g:checkbox not being saved when its switched from on to off for a child in one-to-many relationship. For example: class Parent { Boolean enabled static hasMany = [children: Child] static constraints = { enabled(blank: true, nullable: true) } } class Child { Boolean enabled static belongsTo = [parent: Parent] static constraints = { enabled(blank: true, nullable: true) } } Posting to Parent controller true/false values will work for Parent: <g:checkBox name="enabled" value="${parentInstance?.enabled}"/> However, not for Child! When posting to Parent controller I can only go from false to true, trying to change from true to false again will not work: <g:each in="${parentInstance.children}" status="i" var="child"> <g:checkBox name="child[${i}].enabled" value="${child?.enabled}" /> </g:each> That seems to be a bug. Any ideas? Thanks.

    Read the article

  • ordering an acts_as_tree relationship

    - by timpone
    I have a Category class that is defined like this: class Catergoy < ActiveRecord::Base acts_as_tree :parent_id I'd like the ordering to be by the position value which is a float such that: category-1 category-2, parent_id=1, position=0.5 category-3, parent_id=2, category-4, parent_id=1, position=1 How would I specify this? I tried acts_as_tree :parent_id :order => :position acts_as_tree :parent_id, :order => :position but these are not working. Any ideas how to specify this relationship? Or if I'm missing something else? thx in advance

    Read the article

  • One to two relationship in Doctrine with YAML

    - by Jeremy DeGroot
    I'm working on my first Symfony project with Doctrine, and I've run into a hitch. I'm trying to express a game with two players. The relationship I want to have is PlayerOne and PlayerTwo each being keyed to an ID in the Users table. This is part of what I've got so far: Game: actAs: { Timestampable:- } columns: id: { type: integer, notnull: true, unique: true } startDate: { type: timestamp, notnull: true } playerOne: { type: integer, notnull: true } playerTwo: { type: integer, notnull: true } winner: { type: integer, notnull:true, default:0 } relations: User: { onUpdate: cascade, local: playerOne, foreign: id} User: { onUpdate: cascade, local: playerTwo, foreign: id} That doesn't work. It builds fine, but the SQL it generates only includes a constraint for playerTwo. I've tried a few other things: User: { onUpdate: cascade, local: [playerOne, playerTwo], foreign: id} Also: User: [{ onUpdate: cascade, local: playerOne, foreign: id}, { onUpdate: cascade, local: playerTwo, foreign: id}] Those last two throw errors when I try to build. Is there anyone out there who understands what I'm trying to do and can help me achieve it?

    Read the article

  • Entity Framework 4 CTP 5 POCO - Many-to-many configuration, insertion, and update?

    - by Saxman
    I really need someone to help me to fully understand how to do many-to-many relationship with Entity Framework 4 CTP 5, POCO. I need to understand 3 concepts: How to config my model to indicates some tables are many-to-many. How to properly do insert. How to properly do update. Here are my current models: public class MusicSheet { [Key] public int ID { get; set; } public string Title { get; set; } public string Key { get; set; } public virtual ICollection<Author> Authors { get; set; } public virtual ICollection<Tag> Tags { get; set; } } public class Author { [Key] public int ID { get; set; } public string Name { get; set; } public string Bio { get; set; } public virtual ICollection<MusicSheet> MusicSheets { get; set; } } public class Tag { [Key] public int ID { get; set; } public string TagName { get; set; } public virtual ICollection<MusicSheet> MusicSheets { get; set; } } As you can see, the MusicSheet can have many Authors or Tags, and an Author or Tag can have multiple MusicSheets. Again, my questions are: What to do on the EntityTypeConfiguration to set the relationship between them as well as mapping to an table/object that associates with the many-to-many relationship. How to insert a new music sheets (where it might have multiple authors or multiple tags). How to update a music sheet. For example, I might set TagA, TagB to MusicSheet1, but later I need to change the tags to TagA and TagC. It seems like I need to first check to see if the tags already exists, if not, insert the new tag and then associate it with the music sheet (so that I doesn't re-insert TagA?). Or this is something already handled by the framework? Thank you very much. I really hope to fully understand it rather than just doing it without fully understand what's going on. Especially on #3.

    Read the article

  • What is the relationship between IRimTable and PersistenceStore?

    - by Martin
    The BlackBerry Desktop API has the interface IRimTable which apparently maps an "application database" on a BlackBerry device to a virtual structure (i.e, IRimTable has IRimRecords, each of which has IRimField) that developer can browse the handheld device data when it is connected to a desktop computer. Meanwhile, applications in the handheld device can store its data in PersistenceStore databases. The point where I'm stuck is the PersistenceStore API doesn't define any Table or Records or Fields. Does anybody knows what is the relationship between these two classes? And how does the mapping work (if at all) ?

    Read the article

  • Ruby on Rails - Create Entity with Relationship

    - by SooDesuNe
    I'm new to rails, so be nice. I'm building a "rolodex" type application, and this question is about the best way to handle creating an entity along with several relationship entities at the same time. For (a contrived) example: My application will have a Person model, which has_one Contact_Info model. On the create.html.erb page for Person it makes sense for the user of my appliction to create the person, and the contact_info at the same time. It doesn't seem right to include details for creating a contact directly in the create view/controller for person. What's the rails way to handle this?

    Read the article

  • One to One relationship in MySQL

    - by Botto
    I'm trying to make a one to one relationship in a MySQL DB. I'm using the InnoDB engine and the basic table looks like this: CREATE TABLE `foo` ( `fooID` INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `name` TEXT NOT NULL ) CREATE TABLE `bar` ( `barName` VARCHAR(100) NOT NULL, `fooID` INT(11) NOT NULL PRIMARY KEY, CONSTRAINT `contact` FOREIGN KEY (`fooID`) REFERENCES `foo`(`fooID`) ) Now once I have set up these I alter the foo table so that the fooID also becomes a foreign key to the fooID in bar. The only issue I am facing with this is that there will be a integrity issue when I try to insert into either. I would like some help, thanks.

    Read the article

  • Linq2Entities: Update relationship?

    - by Poku
    Hey, How do i create a new row in a table which have a relationship with another table? I have an Employees table and a EmployeeProjects table. One Employee can have 1-* EmployeeProjects. Now i want to create a new EmployeeProject which relates to an Employee. How do i do this? Here is want i have tried so far: var ep = new EmployeeProjects(); ep.JobNo = jobNo; employee.EmployeeProjects.Add(ep); var originalEmployee = GetEmployee(employee.Id); _entities.ApplyPropertyChanges(originalEmployee.EntityKey.EntitySetName, employee); _entities.SaveChanges();

    Read the article

  • Select in a many-to-many relationship in MySQL

    - by Joff Williams
    I have two tables in a MySQL database, Locations and Tags, and a third table LocationsTagsAssoc which associates the two tables and treats them as a many-to-many relationship. Table structure is as follows: Locations --------- ID int (Primary Key) Name varchar(128) LocationsTagsAssoc ------------------ ID int (Primary Key) LocationID int (Foreign Key) TagID int (Foreign Key) Tags ---- ID int (Primary Key) Name varchar(128) So each location can be tagged with multiple tagwords, and each tagword can be tagged to multiple locations. What I want to do is select only Locations which are tagged with all of the tag names supplied. For example: I want all locations which are tagged with both "trees" and "swings". Location "Park" should be selected, but location "Forest" should not. Any insight would be appreciated. Thanks!

    Read the article

  • Custom OData operation / customize EF model to hide join table in many-to-many relationship

    - by AC
    I've got a data model that has two tables with a join table for a many to many relationship & creating an OData service to expose the data for CRUD ops in a Silverlight app. What I'd like to do is abstract the join table from the service. I'm not sure if the best way to do this would be in the model (using EF in .NET3.5SP1) or if I should do it with a custom service operation. If I do it in the EF model (not sure how I'd do this), then the OOTB WCF Data Service stuff would make it easy to say [..]/Courses(1)/Modules ... otherwise I'd have to create a custom operation to do this. Is it possible to do this in the EF model and if so, how does that work?

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >