Hello, instead of talking let me talk with code:
Dim Contact = Context.Contacts.Include("Phones")
Dim phone = Contact.Phones(0)
Contact.Remove(phone)
How do I refresh the context now, canceling last relation deletion?
I tried:
Context.Refresh(RefreshMode.StoreWins, phone) 'Doesn't recover the relation
Context.Refresh(RefreshMode.Sto...
Hi! I'm getting the following error: "Can't figure out what the other side of a many-to-many should be."
Team Entity:
public class Team : IEntity
{
public int Id { get; set; }
public string Name { get; set; }
public IList<Employee> Employee { get; set; }
public Team()
{
Employee = new List<Employee>();
...
I'm making a game link site, where users can post links to their
favorite web game.
When people post games they are supposed to check what category the
game falls into.
I decided to allow many categories for each game since some games can
fall into many categories.
So the question is, how do I handle this in my view?
And how can I...
Hi guys,
I'm mapping a proprietary database to Hibernate for use with Spring. In it, there are a couple of jointables that, for entity A and entity B have the following schema:
CREATE TABLE AjoinB (
idA int not null,
idB int not null,
groupEnum enum ('groupC', 'groupD', 'groupE'),
primary key(idA, idB, groupEnum)
);
As you ca...
I have the following Django models: -
class Company(models.Model):
name = models.CharField(max_length=50)
is_active = models.BooleanField(db_index=True)
class Phase(models.Model):
company = models.ForeignKey(Company)
name = models.CharField(max_length=50)
is_active = models.BooleanField(db_index=True)
class Proces...
Entity A and B have a many to many relationship using link table AtoB.
If Entity A is deleted, the related links are deleted by hibernate. So far so good.
My problem is that my link table is a view hiding a much more complicated relationship and works perfectly in this situation except when hiberate tries to delete the link rows from t...
Hi!
I have a simple model with news and categories:
class Category(models.Model):
name = models.CharField()
slug = models.SlugField()
class News(models.Model):
category = models.ManyToManyField(Category)
title = models.CharField()
slug = models.SlugField()
text = models.TextField()
date = models.DateTimeFie...
I have a many to many relationship between A and B. (I know I can consider refactoring etc, but that's another matter).
my Code does something like this:
// given aId is the Id of an instance of A, and A has a many to many set of B's
A a = myActiveSession.Get<A>(aId);
a.Bs.Add(new B() {Name="dave"});
and I get an exception bec...
Given the following models, I need to return a list of Links for each Place, grouped by Category.
class Place(models.Model):
name = models.CharField(max_length=100)
class Category(models.Model):
name = models.CharField(max_length=100)
description = models.TextField()
class Link(models.Model):
name = models.CharField(ma...
I have an entity context that includes three tables (see diagram here). The first is a table that contain products, the second contains recipes. The joining table has fields for IDs in both the products and recipes table as well as a 'bit' field called 'featured'.
I've searched and found no example on how to insert only how to select a...
Hi guys
I'm faced with my first real practical usage of a many-to-many relationship and am having a little bit of trouble with the approach...
I'm using ASP.Net MVC and have the following 2 entities: Activity <---> Program.
Now I was wondering what people think of the approach and if there is a better way of doing this:
When pull o...
I have two entities that have a many-to-many relationship; they are mapped with annotations @ManyToMany and @JoinTable. In the database join table I also have "order" column which would indicate in which order B entities are listed in A. (The ordering of Bs is specific for each A).
How can I get Hibernate to order list according to the ...
i want to define a many-to-many relation in a rails project. how is the best way to give the individual relations different meanings?
+------------+ has many +-------------+
| | ---------------------> | |
| person | | project |
| | <--------------------- | ...
Hi! When I test my many to many classes an error occurs:
System.ApplicationException: Actual
count does not equal expected count.
Entities:
public interface IEntity
{
int Id { get; set; }
}
public abstract class Entity : IEntity
{
public virtual int Id { get; set; }
public virtual bo...
I have a many to many relationship between a Team and an Employee entity.
I mapped them as following:
public class EmployeeMap : ClassMap<Employee>
{
public EmployeeMap()
{
// identifier mapping
Id(p => p.Id).Column("EmployeeID");
// column mapping
Map(p => p.EMail);
Map(p => p.LastName)...
According to an example at
http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships
I have three models:
class User(models.Model):
name = models.CharField(max_length=128)
class Group(models.Model):
name = models.CharField(max_length=128)
members = models.ManyToManyField(User, through...
I am implementing a many-to-many mapping in grails using 3NF,
Not using the hasMany or belongsTo property.
Taken from this article it shows and explains quite a lot about its advantages.
Article: http://burtbeckwith.com/blog/?p=169
Presentation notes: http://burtbeckwith.com/blog/files/169/gorm%20grails%20meetup%20presentation.pdf
I'...
Hi, I have a many-to-many relation in 3 tables: ProgramUserGroup and Feature are the two main tables, and the link between them is LinkFeatureWithProgramUserGroup, where I have Foreign key relations to the two parent tables.
I have a dataset with inserts: I want to add a new row to ProgramUserGroup, and a related (existing) Feature to t...
Hi,
I have a many to many relationship between Candidates and Positions. I am trying to limit the list of positions fetched to as follows
ICriteria criteria = this.GetSession().CreateCriteria(typeof(Candidate), "c");
criteria.CreateAlias("c.Positions", "plist",NHibernate.SqlCommand.JoinType.InnerJoin);
criteria.CreateAlias("plist.item...
I have a consignment class that aggregates a FreightDateTime class. At the same time, the FreightDateTime class is also aggregated by the GoodsItem class. In the same manner, FreightDateTime is associated with a number of other classes that I left out for now.
To avoid a databasetable FreightDateTime with ConsignmentId foreign key, a ...