Hi guys,
ok, so I have a database comprising of two tables, products and suppliers.
All suppliers fill in a form and their data is then stored in the suppliers table, and the products table contains a list of all of the products, so when the supplier fills in the form, he can choose as many products as he wishes as I use jQuery JSON a...
I have following association
class Employee
include Mongoid::Document
employee_id :name
references_many :companies, stored_as => :array, :inverse_of => :employees
end
class Company
include Mongoid::Document
field :name
references_many :employees, stored_as => :array, :inverse_of => :companies
end
Now How can I check the uni...
I am using Spring HibernateTemplate, OpenSessionInViewFilter(actually I extended this class and created my own to switch to FLUSH.AUTO Mode) and Mysql for implementing hibernate many-to-many association. However when I save an object, corresponding many-to-many table's values are not inserted. Does anybody can help me? Thank you.
here i...
I have 4 database tables (Channel, User, Message, User2Channel) and according entity classes:
class **Channel** {
int ChannelId {get;set;}
int ISet<User> UsersToChannel {get;set;}
...
}
class **Message** {
int MessageId {get;set;}
Channel Channel {get;set;}
User User {get;set;}
...
}
class **User**{
int UserId {get;set;}
ISet<...
The green plus sign button for adding new instances in the admin form disappears for my MultiSelect field (photos) when I define it in my form. Ie, removing the line with the definition (photos = ...) makes the plus sign appear. However, in order to use a custom Field/Widget I need to figure this out.
class GalleryForm(ModelForm):
...
Lets say I have a Users table with a UserID column and I need to model a scenario where a user can have multiple relationships with another user, e.g. phone calls. Any user can initiate 0...n phone calls with another user.
Would it be a classic junction table like:
UserCalls
-----------------------
| CallerID | CalleeID |
------------...
I have two entities: Employee and Team.
What I want is an EmployeeForm that has the Name of the Team.
How can I achieve this using AutoMapper?
My current "solution" is the following:
Mapper.CreateMap<Employee, EmployeeForm>()
.ForMember(dest => dest.TeamName, opt => opt.MapFrom(x => x.GetTeams().FirstO...
often in books, i see that when a many-to-many relationship is translated to a DB schema, the JoinTable gets a compound key consisting of the primary keys of the tables involved in many-to-many relationship.
I try to avoid compound keys completely. So i usually create a surrogate key even for the JoinTable and allow the database to fill ...
EDIT> i am at a dead end... so i can continue looking for the main reason .. Please tell me how to make a simple criteria for many to many relationships which has more than one eq restrictions, for an example, how to get the person speaking eng & german in the example shown here...
My situation is like this i have two classes person and...
Dearest All,
I have a one-directional many-to-many association: the ListDefinition class has the Columns property of type IList, while a column can be part of several ListDefinition-s. The problem is, whenever I try to remove a column from one Columns collection (without deleting it or removing from other ListDefinitions), I'm getting t...
I have the following entities
public class Client
{
public virtual int Id{get;set;}
public virtual IList<Telephone> Telephones { get; private set; }
}
public class User
{
public virtual int Id{get;set;}
public virtual IList<Telephone> Telephones { get; private set; }
}
public class Telephone
{
public virtual int Id...
@Entity
public class Person implements Serializable {
private int id;
...........
private Set<Languages> languages = new HashSet<Languages>();
...............
@ManyToMany
@JoinTable(name = "link_person_languages")
public Set<Languages> getLanguages() {
return languages;
}
}
@Entity
public...
I have two entities, a Shelf and a Product:
public class Shelf
{
public virtual IList<Product> Products { get; set; }
public Shelf()
{
Products = new List<Product>();
}
}
public class Product
{
public virtual string Name { get; set; }
}
Basically put, a Shelf can contain many Products, and a Product can b...
based on http://stackoverflow.com/questions/1529073/how-to-implement-tagging-system-similar-to-so-in-php-mysql
ive made small changes, and have the following image tag implementation:
SELECT I.imageId, GROUP_CONCAT(DISTINCT T.tagName SEPARATOR ' '), COUNT(*)
FROM Images I
INNER JOIN ImageTagMap M ON I.imageId = M.imageId
INNER JOIN Ima...
hello,
I have a problem that I can't seem to solve.
I have table: Software
and table: PC
they both have many to many relationship between each other, that is, one PC can have many Software and One Software can have many PC's
the link table is: soft-pc
The table soft-pc also has licensing information like, product keys.
now the problem...
I'm trying to turn this query into a view:
SELECT t.*
FROM user t
JOIN (SELECT t.UserId,
MAX( t.creationDate ) 'max_date'
FROM user t
GROUP BY t.UserId) x ON x.UserId = t.UserId
AND x.max_date = t.creationDate
But views do not accept subqueries.
What this does is look for the la...
Hi everyone,
I have 3 tables:
Emails
Foo
EmailFoos (The many to many join table)
Foo can be complete or not.
I need to find the set of emails where the count of completed foos > 0 (and the inverse, but I can probably do that ;)
I tried something like:
SELECT e.id, e.address, count(l.foo_id) as foo_count
FROM emails e
LEFT ...
Dearest All,
I've got a many-to-many association between Lists and ListItems: a List knows about its Items, but a ListItem doesn't know about the containing lists. The cascade is saveupdate.
So, whenever I'm trying to delete a ListItem entity, I'm getting an SQLException saying I'm breaking the referential integrity. NHibernate tries t...
I've got 2 tables: one stores tags, the other stores articles. There's a mode "Get articles by tag", which basically takes all articles, tagged "x". In my articles table I use a filed, called Tags, that stores data in such pattern 'tag1, tag2, tag3, ...'.
So I want to get everything work by just a single query like that:
SELECT *,
...
I'd like to filter the results of a query which returns the results from two tables which have any to many relationship to each other.
Consider the following scenario: (SQL Server or MS Access)
Table: Students
--StudentID
--StudentName
Table: Grades
--StudentID (Foreign Key)
--CourseID (Foreign Key. Ignore for the sak...