relationship

Entity Bean Relationship Visualization

Hi, I'm looking for a tool (preferably freeware) which can visualize - in the form of a diagram the relationships of a set of entity beans in a a database. Thanks in advance, Johnny ...

Rails: Referring back to model the object belongs to

This is probably a dumb question, but I can't seem to find a good answer. I want to know the best way to refer back to the model that an object belongs to. For example: class User < ActiveRecord::Base has_many :posts end class Post < ActiveRecord::Base belongs_to :users end So, to get the user's posts, I can use user.posts, b...

Update hasone relation behaves strangely (cakephp)

I've got an existing Showcase that hasOne Gallery. The Gallery already exists with the foreignKey showcase_id set to the proper value. The Gallery has a text field that I try to update via the Showcase-controller. The result I get is an extra Gallery entry, along the original one, instead of an update of the original entry. What am I do...

sql closed loop relations; what could go wrong?

Hi, I am working with a database with the following design. I read it is not a good practice to have closed loops in a database design, and i have more than one. But i cannot remember why. So not sure how this might affect me. Any examples how this could be dangerous? Edit: went through my ebooks, found what i was reading was Begin...

Setting a value in one entity programatically from another entity. Core Data questions...

I'm fairly new to Core Data, have looked through many tutorials and forums and haven't found the elegant solution to my problem: I've got three entities in my model: Worker, Task, and SubTask. Each has a to-many relationship to the entity below it and a to-one inverse. Worker has many Tasks, each Task has many SubTasks, each SubTask has...

Multiple one to many relationships using the same 2 tables in ruby on rails?

I have a database with 2 tables; Users and Revisions. Revisions has multiple one-to-many relationships to the users table, for example created_by, verified_by, published_by (each field being a foreign key user id). How would I go about defining this relationship in my Rails models? ...

Many-to-many relationship for many types of entities

I have four tables: Disks, Folders, Files and Links. It is four types of entities, and they can not be merged into one type (e.g. into one table) because they have different number and types of attributes. And there are relationships: Disks can contain Folders, Files and Links; Folders can contain Folders, Files and Links too; Files an...

Would you ever create a relationship on a natural ID or use an internal ID and emulate the natural ID relationship?

Possible Duplicate: Surrogate Vs. Natural/Business Keys The title says it all. If given two tables, Level1 [ID, Title, Number] Level2 [ID, FKID???, Title, Number] A user of the system understands that Level2 is related to Level1 with based on Level1's Number, my question to you is, would you make the relationship based on the...

Wrapping my head around N parent->child associations

I'll try to explain this the best I can. I'm having quite a bit of difficulty trying to figure out this logic. Basically, I have a collection that includes thousands of objects which are each made up of a Parent and a Child property. So, roughly, this: public class MyObject{ public string Parent { get; set; } public string ...

One to many link table causing duplicate rows returned

Everything I've seen so far is about removing duplicate entries in a database automatically. I want to stress at the beginning of this that there is no duplicate data in the database. I'll also start with the fact that I'm very much still learning about RDBMS design, normalization, relationships, and, most of all, SQL! I have a table ...

cake php use of table relations

Whats the usage of creation relations like var $belongsTo = array( 'UserType' => array( 'className' => 'UserType', 'foreignKey' => 'user_type_id', 'conditions' => '', 'fields' => '', 'order' => '' ) ); //The Associations below have been created with al...

CakePHP Relationships - How to setup relationship for message system ?

Hi ! I am trying to make a messages functionality similar to the facebook. Just the message thing and not facebook. A brief descriptions does like this. 1) There are a number of users ( user table) 2) One person can send a message to one or more than one person. 3) There can be multiple reply to the same message. 4) If its send to multi...

Relationship problem in Cakephp. How to fetch data?

Hi ! I am trying to make a messages functionality similar to the facebook. Just the message thing and not facebook. A brief descriptions does like this. 1) There are a number of users ( user table) 2) One person can send a message to one or more than one person. 3) There can be multiple reply to the same message. 4) If its send to multi...

Cakephp HABTM relation

i have theses tables article , article_currency, currency in database and i made HABTM between article and currency like this var $hasAndBelongsToMany = array('currency'=>array('className' => 'currency','joinTable'=>'article_currency','foreignKey' => 'articleid','associationForeignKey' => 'CurrencyID')); var $hasAndBelongsToMany = a...

Ideas/tools/frameworks/... for an information source independent, interactive query system?

This is a conceptional question. I'm not (yet) familiar with the involved technologies, please bear this in mind. I'm thinking of developing a system that lets users make interactive queries, primarily for fault diagnostics. Users should be provided with the ability to start a "query" by entering some small peace of information. Let'...

ORMers,how are you going to deal with this in the ORM style?

We are modifying our post on stackoverflow. And we only changed the tags part,removed tag1,tag2 and added tag3,tag4. After pressing the Post Your Question button,these things should be done: reduced the count column for tag1,tag2 by 1 delete the relation between the post and tag1,tag2 if tag3,tag4 already exists,increase the count co...

UI: What are the different ways to display a Has and Belongs to Many relationship?

This is not a question about a specific framework. I am using plain php with jquery. I am trying relate multiple products to multiple sets of options. That is each product can have multiple non-exclusive sets of options related to them. What would be the best way to represent this on screen? I suppose it could be a multiselect box. That ...

How to relate keywords to records - Many to Many

Hi All, I am looking for suggestions on database design for a sample jobs listing application. I have many jobs that I would like to associate various keywords with. Each job can have multiple keywords. I would like to store the keywords in a seperate table instead of in a field within the Job table so as to avoid mispellings in keyword...

Entity Relationships - Can a weak entity take part in a 'one to many' relationship as the 'one'

Hi, With the following entity relationship structure I'm struggling to figure out if the relationship between the LOAN and ITEM entities is valid? The weak entity of LOAN uses a partial key of 'loan_dateLeant' and the primary keys from CUSTOMER and ITEM to form LOANs primary key. However LOAN has a 'one to many' relationship with ITEM ...

NSManagedObject relationship undo

I have a NSManagedObject ObjA that has a many-to-many relationship with another NSManagedObject ObjB. I initialize it with [NSEntityDescription insertNewObjectForEntityForName:@"ObjA" inManagedObjectContext:app.context]; When I perform undo without performing save - the object is not added to the persistent store. But - when I add an i...