Search Results

Search found 2412 results on 97 pages for 'relationship'.

Page 64/97 | < Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >

  • Doctrine: Relating a model to itself using a link table, like "This event is related to to the following other events"

    - by mattalexx
    So in English, the relationship would sound like "This event is related to to the following other events". My first instinct is to create an EventEvent model, with a first_event_id field and a second_event_id field. Then I would define the following two relationships in the Event model: $this->hasMany('Event as FirstRelatedEvents', array('local' => 'first_event_id', 'foreign' => 'second_event_id', 'refClass' => 'EventEvent')); $this->hasMany('Event as SecondRelatedEvents', array('local' => 'second_event_id', 'foreign' => 'first_event_id', 'refClass' => 'EventEvent')); But I would rather not have to use two relationships on the Event model. Is there a better way to do this?

    Read the article

  • SQL Server: Cross-tabulation, please help

    - by user335160
    I want to achieve the results shown in the attached image. The table structure and data are: Table relationship: Facility Limit -> one to many -> Facility Sub Limit Tables structure and data Facility Limit Id OverallIBLimitId Product Type 1 1 RPA 2 1 CG 3 2 RPA 4 3 CG Facility Sub Limit Id FacilityLimitId Sub-Limit Type Amount Tenor Status Status Date 1 1 RPA at max 2,000,0000.00 2 months Approved January 5, 2011 2 1 Oil 3,000,0000.00 3 yrs Approved January 5, 2011 3 2 CG at minor 4,000,0000.00 1 yr Approved January 5, 2011 4 2 CG at max 5,000,0000.00 6 months Approved January 5, 2011 5 2 Flood Component 1 5,000,0000.00 6 months Approved January 5, 2011 6 2 Flood Component 2 6,000,0000.00 3 yrs Approved January 5, 2011 7 3 RPA at minor 1,000,0000.00 6 months Approved January 5, 2011 8 4 One-Off 1,000,0000.00 6 months Approved January 5, 2011

    Read the article

  • How to transform html anchor <a> to WordML

    - by Monomachus
    Hi, I need to transform an anchor tag to WordML without using relationships. Is it possible? I found the w: anchor property but seems it refers only to internal document anchors and not to links or URLs. <w:hyperlink w:anchor="chapter3"> <w:r> <w:t>Go to Chapter Three</w:t> </w:r> </w:hyperlink> So it would be great if something similar would be possible to do without making an Id in relationship document and than referring this id from w:hyperlink. Anyone knows something like that?

    Read the article

  • Looking for an algorithm in vb.net or c# but I don't know it's name!

    - by Jules
    I'll do my best to explain what the algorithm is supposed to do: There's a class 'Recipe'. Each Recipe can include other Recipes but cannot include itself or any other Recipe that includes it. So, a simple example is we have just two Recipes A & B. If A adds B first, then later on B cannot add A because it will cause a loop. A more complicated example is: A,B,C (1) Recipe C Adds B (2) Recipe B Adds A (3) Recipe A attempts to add C, but can't because of the relationship. C - B - A. I can do this myself, I just wondered if this was a standard named algorithm and I could grab the optimal solution. Thanks

    Read the article

  • LINQ to Entity, joining on NOT IN tables

    - by SlackerCoder
    My brain seems to be mush right now! I am using LINQ to Entity, and I need to get some data from one table that does NOT exist in another table. For example: I need the groupID, groupname and groupnumber from TABLE A where they do not exist in TABLE B. The groupID will exist in TABLE B, along with other relevant information. The tables do not have any relationship. In SQL it would be quite simply (there is a more elegant and efficient solution, but I want to paint a picture of what I need) SELECT GroupID, GroupName, GroupNumber, FROM TableA WHERE GroupID NOT IN (SELECT GroupID FROM TableB) Is there an easy/elegant way to do this? Right now I have a bunch of queries hitting the db, then comparing, etc. It's pretty messy. Thanks.

    Read the article

  • How to specify a different column for a @Inheritance JPA annotation

    - by Cue
    @Entity @Inheritance(strategy = InheritanceType.JOINED) public class Foo @Entity @Inheritance(strategy = InheritanceType.JOINED) public class BarFoo extends Foo mysql> desc foo; +---------------+-------------+ | Field | Type | +---------------+-------------+ | id | int | +---------------+-------------+ mysql> desc barfoo; +---------------+-------------+ | Field | Type | +---------------+-------------+ | id | int | | foo_id | int | | bar_id | int | +---------------+-------------+ mysql> desc bar; +---------------+-------------+ | Field | Type | +---------------+-------------+ | id | int | +---------------+-------------+ Is it possible to specify column barfo.foo_id as the joined column? Are you allowed to specify barfoo.id as BarFoo's @Id since you are overriding the getter/seeter of class Foo? I understand the schematics behind this relationship (or at least I think I do) and I'm ok with them. The reason I want an explicit id field for BarFoo is exactly because I want to avoid using a joined key (foo _id, bar _id) when querying for BarFoo(s) or when used in a "stronger" constraint. (as Ruben put it)

    Read the article

  • Handling auto-incrementing IDENTITY SQL Server fields with LINQ to SQL in C#

    - by Maxim Z.
    I'm building an ASP.NET MVC site that uses LINQ to SQL to connect to SQL Server, where I have a table that has an IDENTITY bigint primary key column that represents an ID. In one of my code methods, I need to create an object of that table to get its ID, which I will place into another object based on another table (FK-to-PK relationship). At what point is the IDENTITY column value generated and how can I obtain it from my code? Is the right approach to: Create the object that has the IDENTITY column Do an InsertOnSubmit() and SubmitChanges() to submit the object to the database table Get the value of the ID property of the object

    Read the article

  • PHP/MySQL: Check if something 'belongs-to' something else?

    - by Nebs
    I have two tables: Stores and Items. The relationship is: Stores 1---* Items In PHP/MySQL what would be the best (fastest/simplest) way to check if a particular item belongs to a particular store. In other words given for example: $store_id = 1; $item_id = 12; I want to check if item 12 belongs to store 1 (and not some other store). I usually do a select on Items matching both the store_id and item_id and limit the results to 1. Then check how many rows (0 or 1) were returned with mysql_num_rows. Is there a better way? Update: Both tables have an "id" column. The Items table has a "store_id" column.

    Read the article

  • When to use MVC Scaffolding via NuGet vs MVC Scaffolding via MVC3 Tools Update

    - by James
    I am a little confused about the various different "mainstream" scaffolding options for MVC3. There is a NuGet package called MVCScaffolding. It first showed up in Jan 2011, but seems to be active and have recent updates, and be developed by Scott Hanselman, among others. Then in May 2011 came the MVC3 Tools Update. This seems like it incorporated the original scaffolding ideas into an "out of the box" scaffolding options. However, this has not been updated since. So - what is the relationship between these two scaffoldings (if any). Are there cases when one should be used over the other, or is it just a matter of taste? Does Visual Studio 2012 or MVC4 change the game on any of this? Thanks for any input.

    Read the article

  • MySQL Many to Many with Unique keys and Update/Select if Exists otherwise Insert

    - by Jayrox
    In my goal to have a Many-to-Many relationship in my MySQL database I have arrived at another bridge to build. Current Tables: Users (id, name) Tags (id, name) User_Tags (user_id, tag_id) Here is the goal: I would like to have the ability to take a tag i.e: #fb and insert it into my Tags database which has a unique constraint on name and if the tag exists I would like to return it's id I would like to insert the tag.id and the current user's user.id into User_Tags. I do not have any unique constraints on the User_Tags table because I would like to be able to track the user's most commonly used tags and present them in a list ordered by frequency of use. I am currently developing this project in PHP using prepared statements. Additionally, performance is not currently an issue as my user count is still fairly small, but it is steadily growing and may be an issue in the future.

    Read the article

  • Ruby on Rails updating join table records

    - by Eef
    Hey, I have two models Users and Roles. I have setup a many to many relationship between the two models and I have a joint table called roles_users. I have a form on a page with a list of roles which the user checks a checkbox and it posts to the controller which then updates the roles_users table. At the moment in my update method I am doing this because I am not sure of a better way: role_ids = params[:role_ids] user.roles.clear role_ids.each do |role| user.roles << Role.find(role) end unless role_ids.nil? So I am clearing all the entries out then looping threw all the role ids sent from the form via post, I also noticed that if all the checkboxes are checked and the form posted it keeps adding duplicate records, could anyone give some advice on a more efficent way of doing this?

    Read the article

  • How to configure a has_many association with non-ActiveRecord model

    - by Callmeed
    My Rails app has a normal ActiveRecord "Account" model stored in the database. The model will store the URL to a remote XML file which defines some other objects. For example, the Account has_many :galleries but the Gallery model is simply defined by nodes in the XML document. So how do I get /accounts/1/galleries to show the galleries from that account's XML? How do I setup this relationship? I know how to do basic non-AR models, but I'm not sure how to define the association or if I need to create a Gallery model at all.

    Read the article

  • From comma separated list to individual item result set. *mysql

    - by Raziel
    I'm doing some data migration from a horribly designed database to a less horribly designed database. There is a many to many relationship that has a primary key in one table that corresponds to a comma separated list in another. FK_ID | data ------------- 1,2 | foo 3 | bar 1,3,2 | blarg Is there a way to output the FK_ID field with each comma separated element as a single line in the result set? result set FK_ID | data ------------- 1 | foo 2 | foo 3 | bar 1 | blarg 2 | blarg 3 | blarg I'm thinking this would require some sort of recursive query which I don't think mysql has. Thanks in advance.

    Read the article

  • Rails 3: habtm migration, primary key issue

    - by Brian Wigginton
    I'm trying to setup a migration file for a habtm relationship, however when I run the migration I'm getting the following error: Primary key is not allowed in a has_and_belongs_to_many join table (parts_vehicles). Here is my migration file (20110111035950_create_parts_vehicles.rb): class CreatePartsVehiclesJoinTable < ActiveRecord::Migration def self.up create_table :parts_vehicles, :id => false do |t| t.integer :part_id t.integer :vehicle_id end end def self.down drop_table :parts_vehicles end end The documentation example states to use :id => false to disable a primary key from being generated, but I'm still getting the error.

    Read the article

  • Rails belongs_to issue in the views

    - by Jacobo Tibaquira
    Hi, Im having problems with an association in rails: Currently I have Post and User models, and the relationship is set this way: class User < ActiveRecord::Base attr_accessible :username, :name, :lastname has_many :posts end class Post < ActiveRecord::Base attr_accessible :title, :body belongs_to :user end However, in my app/views/posts/index.html.haml when Im trying to access the username for the post I get this error: undefined method `name' for nil:NilClass This is my view: - title "Posts" %table %tr %th Title %th Body %th Author - for post in @posts %tr %td= h post.title %td= h post.body %td= h post.user.name %td= link_to 'Show', post %td= link_to 'Edit', edit_post_path(post) %td= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %p= link_to "New Post", new_post_path Any thoughts of what Im doing wrong will be appretiated

    Read the article

  • Oracle Forms 6i master-detail question from a painfully new newbie

    - by Murasaki
    Hello, I have a form that contains 3 blocks (block a, b, c). There is a master-detail relationship between b (detail) and c (master). Data-flow: you enter an ID in block a, which in turn populates block c and corresponding details in block b. Control goes immediately to block c. Objective: I need to be able to update details of block b. Issue: I cannot navigate to block b. Keep in Mind: --In the Property Palette Keyboard Navigable is set to "Yes" --Insert Allowed and Update Allowed are set to "Yes." If someone could respond ASAP I would really appreciate it. Thank you.

    Read the article

  • CPU Usage relative to number of users? - ASP.Net Application

    - by soldieraman
    My Asp.net application uses 25-30% of the CPU on a test server which has 600 MB Ram on it. I can see the asp_wb process taking that much percentage of CPU. This is when I am testing using one user. How many users can the server afford then without falling over? Is there a relationship between the CPU Usage and number of user aka if there are 2 users my application will sky rocket to 60% of memory usage? Or does/Should/How does the server handle this?

    Read the article

  • Entity Framework: Setting EntityReference EntityKey causes exception on save

    - by NYSystemsAnalyst
    I have a table with a ModifiedUserID field that is a foreign key to a User table. In entity framework, I'm loading the first table, but not the users table. I have the user ID of the current user, and would like to set the ModifiedUserID to that value for all entities that have been modified prior to saving. Before calling SaveChanges(), I use the ObjectStateManager to get all modified entities. Since I do not have the user object, but I do have the user ID, I set the EntityReference.EntityKey property as follows: entity.UserReference.EntityKey = New EntityKey("MyContainer.User", "UserID", DatabaseUserID) This works fine, but when I execute SaveChanges(), I receive the following error: A relationship is being added or deleted from an AssociationSet 'FK_Table1_User'. With cardinality constraints, a corresponding 'Table1' must also be added or deleted. Now, I see that setting the EntityReference.EntityKey creates a new AssociationSet entry, but how to I prevent this error?

    Read the article

  • NHibernate Criteria Transform Result

    - by isuruceanu
    Hi I have an SecurityGroup entity witch has Memebers and Application properties. Application is a lookup. So securityGroups is in many-to-many relationship with User table and one-to-many with LookupApplciation (FK) Now I want to select all application linked to a specific user. I have follow criteria: public IList<LookupApplication> GetApplicationByUser(User user) { return this.Session.CreateCriteria(typeof(SecurityGroup), "sg") .CreateAlias("Members", "u") .CreateAlias("Application", "al") .Add(Restrictions.Eq("u.Id", user.Id)) .List<LookupApplication>(); } It trows an exception The value "Edi.Advance.Core.Model.Security.SecurityGroup" is not of type "Edi.Advance.Core.Model.Lookups.LookupApplication" and cannot be used in this generic collection. Parameter name: value and it is right. How can I transform the result to IList<LookupApplication>? Thanks

    Read the article

  • In CouchDB, how to get documents limited on value in related document? In terms of SQL, how to make WHERE on JOINed table

    - by amorfis
    Crossposting from [email protected] Assume we have two kind of documents in CouchDB. Person and Car: Person: _id firstname surname position salary Car: _id person_id reg_number brand So there is one to many relationship. One person can have many cars. I can construct map function to get every person and his/her car next to each other. In such case key is array [person.id, 0] and [car.person_id, 1]. What I can't do, is limiting this view to owners of specific brand only, e.g. if I need salaries of owners of Ferrari.

    Read the article

  • SubSonic isn't generating MySql foreign key tables

    - by keith
    I two tables within a MySql 5.1.34 database. When using SubSonic to generate the DAL, the foreign-key relationship doesn't get scripted, ie; I have no Parent.ChildCollection object. Looking inside the generated DAL Parent class shows the following; //no foreign key tables defined (0) I have tried SubSonic 2.1 and 2.2, and various MySql 5 versions. I must be doing something wrong procedurally - any help would be greatly appreciated. This has always just worked 'out-the-box' when using MS-SQL. TABLE `parent` ( `ParentId` INT(11) NOT NULL AUTO_INCREMENT, `SomeData` VARCHAR(25) DEFAULT NULL, PRIMARY KEY (`ParentId`) ) ENGINE=INNODB DEFAULT CHARSET=latin1; TABLE `child` ( `ChildId` INT(11) NOT NULL AUTO_INCREMENT, `ParentId` INT(11) NOT NULL, `SomeData` VARCHAR(25) DEFAULT NULL, PRIMARY KEY (`ChildId`), KEY `FK_child` (`ParentId`), CONSTRAINT `FK_child` FOREIGN KEY (`ParentId`) REFERENCES `parent` (`ParentId`) ) ENGINE=INNODB DEFAULT CHARSET=latin1;

    Read the article

  • How to select elements from a set that are children of another element

    - by Tatu Ulmanen
    Hi, The title is a bit confusing but here's what I'm after: I have a set of elements containing all the h3 elements in a page. In jQuery terms: var mySet = $('h3'). I also have an div element var myContainer = $('div#foo') I need to find all items in the set mySet that are children of myContainer. Any ideas? I bet there's some magical one liner for this but I cannot think of any. I'd rather not loop through every element in the set manually and use .closest(myContainer) or something like that to determine the relationship. Note that in my scenario, I cannot use a new selector like $('div#foo h3') (that would be too easy) as I don't have access to the actual selector values. So it has to be dynamic.

    Read the article

  • Visual Studio Publish using Web Deploy gives SSL Exception?

    - by user1267778
    Im trying to use Web Deploy with arvixe hosting. I enabled Publishing with the host but I get SSL exception when I hit publish. Is anybody familiar with the following exception: Error 59 Web deployment task failed.(Could not complete the request to remote agent URL 'https://yew.arvixe.com:8172/msdeploy.axd?site=mywebsite.com'.) Could not complete the request to remote agent URL 'https://yew.arvixe.com:8172/msdeploy.axd?site=mywebsite.com'. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. The remote certificate is invalid according to the validation procedure. 0 0 myapplication_MVC4 Thanks

    Read the article

  • Java JPA @OneToMany neededs to reciprocate @ManyToOne?

    - by bguiz
    Create Table A ( ID varchar(8), Primary Key(ID) ); Create Table B ( ID varchar(8), A_ID varchar(8), Primary Key(ID), Foreign Key(A_ID) References A(ID) ); Given that I have created two tables using the SQL statements above, and I want to create Entity classes for them, for the class B, I have these member attributes: @Id @Column(name = "ID", nullable = false, length = 8) private String id; @JoinColumn(name = "A_ID", referencedColumnName = "ID", nullable = false) @ManyToOne(optional = false) private A AId; In class A, do I need to reciprocate the many-to-one relationship? @Id @Column(name = "ID", nullable = false, length = 8) private String id; @OneToMany(cascade = CascadeType.ALL, mappedBy = "AId") private List<B> BList; //<-- Is this attribute necessary? Is it a necessary or a good idea to have a reciprocal @OneToMany for the @ManyToOne? If I make the design decision to leave out the @OneToMany annotated attribute now, will come back to bite me further down.

    Read the article

  • Performing complex query with Dynamics CRM 4.0

    - by dub
    Hi, I have two custom entites, Product and ProductType, linked together in many-to-one relationship. Product has a lookup field to ProductType. I'm trying to write a query to fetch Type1 products with a price over 100, and Type2 products with a price lower than 100. Here's how I would do it in SQL : select * from Product P inner join ProductType T on T.Id = P.TypeId where (T.Code = 'Type1' and P.Price >= 100) or (T.Code = 'Type2' and P.Price < 100) I can't figure out a way to build a QueryExpression to do exactly that. I know I could do it with two queries, but I'd like to minimize roundtrips to the server. Is there a way to perform that query in only one operation ? Thanks!

    Read the article

< Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >