problem about one-to-many-Collection of common programming errors
AOphagen
core-data foreign-keys one-to-many nssortdescriptor unrecognized-selector
I am trying to save a one-to-many relation in core data. There is a user decision involved to determine whether the new child list object needs to be attached to a new parent object. In the other case an existing database entry is used as a parent object. Under certain circumstances after saving, the app crashes.FINAL EDIT: Sorry if you mind me keeping all of the edits, I still will. The process of enlightenment was quite convoluted. After all I started out thinking it was a data conflict… Tha
tkanzakic
ios xcode core-data one-to-many relation
I want to save a method, which has some relations to other Entities. The approach and background are to-one relations, but the method should have be able to have several tipps and examples. I already looked at many other questions and tutorials but I do not know why it won’t work. dataToBeSaved is a Dictionary containing the data as Strings I want to assign to the method.Here is Method.h@interface Method : NSManagedObject@property (nonatomic, retain) NSNumber * id; @property (nonatomic, retain)
TechZen
iphone core-data entity-relationship saving one-to-many
I’m working on a small iphone app using Core Data, where I got a Person and an Image entities. The relationship between Person and Image is to-many. One person to many images. Problem happens at save method. During saving first I need ‘ADD’ more than one image data, that I got from ImagePickerViewController, to Person and then ‘SAVE’ the Person entity to actual DB. ((in the same method))if (managedObjectContext == nil) { managedObjectContext = [(CoreDataCombine01AppDelegate *)[[UIApplication sha
Paulo Rodrigues
ios core-data one-to-many nsmanagedobject
I am having troubles with the relationship I have setup in CoreData. Its one to many, a Customer can have many Contact, these contacts are from address book.My model it looks like this:Customer <—->> Contact Contact <—–> CustomerContact.h@class Customer;@interface Contact : NSManagedObject@property (nonatomic, retain) id addressBookId; @property (nonatomic, retain) Customer *customer;@endCustomer.h@class Contact;@interface Customer : NSManagedObject@property (nonatomic, reta
Keith
google-app-engine gae-datastore one-to-many jdo
My web app suddenly won’t allow people to buy our products. I don’t know what to do.Last night one of our engineers accidentally removed the @Persistent tag from an owned one-to-many field (in the parent class). He uploaded this without testing it to the App Engine server. We got reports that people could not buy things, so we looked at the changes, went in and restored the @Persistent tag. But now we get an exception every time the code tries to modify that field.Please help – I don’t know what
Paul Galavic
iphone objective-c one-to-many nssortdescriptor
I use Core Data database. I have Entity Album, that has many entities SpecificImage (key to get set of these images is @”specificImages”) I want to get Album with id = 1 and to sort attached SpecificImages by id. I tried NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@”specificImages.id” ascending:YES];but I get the error Terminating app due to uncaught exception’NSInvalidArgumentException’, reason: ‘to-many key not allowed here’Here is my code:NSString *entityName =
MPelletier
ios table core-data one-to-many
Data SetupProjects -Project Name -perHour Relationship-relatedTime (to MANY) Times-dateAdded -totalTimeRelationship -relatedProject (to ONE) This is my current core data set up. Ill explain what i’m trying to do. I want to make it so that “Projects” is stored in a table view controller and when you click on a specific table cell it takes you to another table view controller with all the “Times” displayed on it.Currently this is my cod
holex
ios core-data one-to-many
I create new child entity in detailed view controller. So I send in seguedetailedViewController.managedObjectContext = managedObjectContext; detaledViewController.parent = currentParent; //type of ParentAt detailViewController.m-(IBAction)saveChildObj:(id)sender{self.childEntity= [NSEntityDescription insertNewObjectForEntityForName:@”ChildEntity” inManagedObjectContext:self.managedObjectContext];self.childEntity.childEntityName= self.childEntityName.text;[self.parent addMyChildObject:self.childE
QED
ios core-data one-to-many
Not sure what I’m doing wrong here.School has a to-many to Student, and Student has its inverse.A little test code as follows:@class Student;@interface School : NSManagedObject@property (nonatomic, retain) NSString * name; @property (nonatomic, retain) NSOrderedSet *students; @end@interface School (CoreDataGeneratedAccessors)- (void)insertObject:(Student *)value inStudentsAtIndex:(NSUInteger)idx; – (void)removeObjectFromStudentsAtIndex:(NSUInteger)idx; – (void)insertStudents:(NSArray *)value atI
flexaddicted
ios core-data nspredicate one-to-many
I set up the following model in Core Data.Book has a to-many relationship, called toBookOrders, with OrderBook entity. The inverse is called toBook. Book has a BOOL value property called isSync.I set up the following NSPredicate.NSEntityDescription* entityDescription = [NSEntityDescription entityForName:@”Book” inManagedObjectContext:moc]; NSPredicate* predicate = [NSPredicate predicateWithFormat:@”isSync == 0 AND SUBQUERY(toBookOrders, $x, $x.toBook == SELF)”];Through this predicate I need to g
lps
iphone core-data count one-to-many predicate
I have an entity matches which has a related to-many entity sets. I want to get a count of how many sets have the attribute ‘set_finished’ set to YES for a particular match. I’m trying to do this with:NSPredicate *predicate = [NSPredicate predicateWithFormat:@”ANY set_finished == YES”];NSUInteger numberOfFinishedSets = [[[match valueForKeyPath:@”sets”] filteredArrayUsingPredicate:predicate ] count];The second line crashes with this error, which I don’t understand. Can anyone shed some light on t
manu
delete doctrine2 one-to-many entities symfony-2.1
I have two entities : Episode and Version. When I trie to delete a version a get an exception:Notice: Undefined index: episode in /var/www/Mendrock/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php line 1561 I already check relations but I don’t found the error.My entites: Episodenamespace Mendrock\Bundle\SagaBundle\Entity;use Doctrine\ORM\Mapping as ORM;/*** Mendrock\Bundle\SagaBundle\Entity\Episode** @ORM\Table(name=”episode”)* @ORM\Entity(repositoryClass=”Mendrock\Bundl
Mark Glass
java hibernate delete mapping one-to-many
If I delete a record from the Parent table I want the corresponding records in the child table to be deleted. How can I make Hibernate delete from the Child table rather than attempt to update with a null? I’m using Hibernate 3 but cannot use annotations at this time. I’ve attached copies of HBM, DAO etc below. — Thank you in AdvanceWhen attempting to delete data from tables in Parent/Child relationship I get the following error:Testcase: testDelete(com.dressbarn.imbo.model.data.hibernate.dao.
Snæbjørn
c# entity-framework entity-framework-5 one-to-many dbcontext
Adding an entity with 1 level of one to many relationship is pretty straight forward.using (var dbCtx = new DbContext()) {dbCtx.Stuff.Add(myObject);dbCtx.SaveChanges(); }But how do you add an object with 2 levels? Adding it in the same way omits the 2. level. Which means that the Bar objects (in the example below) isn’t saved. What am I doing wrong?Object graphInherited objectspublic class BaseEntity {public int Id;// Omitted properites… }public class MyEntity : BaseEntity {// Omitted properit
manix
php doctrine2 doctrine one-to-many
Well, I have these three tables:likesid_like | post | post_typepost: it has the post id where the “like button” was triggered. post_type: it has the type of the post, it could “article” or “comment”.Commentid_comment | bodyArticleid_article | bodyI am trying to create the models “Article” and “Comment” where each one can has an array of its likes. For example, I have tried this with:Model Like/*** @Entity* @Table(name=”likes”)*/ class Like {/*** @Id @Column(type=”integer”, nullable=false, name=”
user1961082
symfony2 doctrine relationship one-to-many
I have a one to many relationship where one page has many versions. **page**id parent_id**page_version** id page_id title published dateThese are related by the foreign key page_id. So I have a Page entity and a PageVersion entity:class Page {/*** @ORM\OneToMany(targetEntity=”PageVersion”, mappedBy=”page”)*/private $pageversions; }class PageVersion {/*** @var page** @ORM\ManyToOne(targetEntity=”Page”, inversedBy=”pageversions”)**/private $page;}So I can get all page versions for each page. Howev
Cris
doctrine2 one-to-many cascade
I’m having some trouble to persist and object with an owning sub-object. More specifically I have an User class which owns at least one PGPKey object.The following code snippet fails:$user = new User(“username”,”password”); $em->persist($user);with the error:SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘PGPKeys.owner’ cannot be nullThe Problem to me is as follows: The User.idUser field, which corresponds to the PGPKey.owner is a GeneratedValue and thus still undefined at the t
DataNucleus
hibernate filter annotations one-to-many
I have a very simple one to many relationship and want to filter the many side (collection) using an in clause. I can’t get the filter working. Either Hibernate complains the filter parameter is undefined (when using Set or Integer as the type) or it says the values being passed in are of the wrong type (when using int the param type)Relationship: A Category has many test cases, a test case has only one categoryPojo#1@Entity @Table(name = “CATEGORY”) public class Category {@Id@Column(name = “CAT
Xavier Nodet
c++ templates notifications one-to-many
I would like to create in C++ a Notifier class that I will use in other objects to notify various holders when the object gets destroyed. template <class Owner> class Notifier<Owner> { public:Notifier(Owner* owner);~Notifier(); // Notifies the owner that an object is destroyed };class Owner;class Owned { public:Owned(Owner* owner); private:Notifier<Owner> _notifier; };My point is that as I have a dense and complicated object graph, I’d like to avoid storing the address of the o
ManseUK
php symfony2 doctrine2 one-to-many composite-key
I have three entities PYS, VOTO and USUARIO. The problem comes in the One-to-many relation of VOTO with PYS because VOTO’s Pimary Key is composite and mappedBy=”pys” returns index undefined. I’ve tried with examples of doctrine’s documentation but the error is the same.This is the error:Notice: Undefined index: pys inC:\Programming\xampp\htdocs\filmboot\vendor\doctrine\orm\lib\Doctrine\ORM\Query\SqlWalker.phpline 826This is VOTO entity:namespace Filmboot\UsuarioBundle\Entity;use Doctrine\ORM\Map
maxwell2022
symfony2 doctrine2 one-to-many many-to-one
I had a big time trying to figure out how to setup a ManyToOne -> OneToMany relationship with Doctrine 2 and it still not working…Here is the application behaviour:A site has Pages A User can write Comment on a PageHere are my Entities (simplified):Comment Entity:*** @ORM\Entity* @ORM\Table(name=”comment”)*/ class Comment {/*** @ORM\Id* @ORM\Column(type=”integer”)* @ORM\GeneratedValue(strategy=”AUTO”)*/protected $id;/*** Many Comments have One User** @ORM\ManyToOne(targetEntity=”\Acme\UserBund
Dougman
jpa jboss ejb one-to-many
Problem is inserting data to database. Using JPA, JBoss, MySQL. What i’m doing wrong? This is one-to-many. I wanna insert some ‘user’ to User table, and give him some role. I made two tables in MySQL 5.2 Workbench and generated this using JPA in eclipse. table UserRole:CREATE TABLE IF NOT EXISTS `virtual_trainer`.`user_roles` (`role_name` VARCHAR(45) NOT NULL ,`users_id` INT NOT NULL ,`name` VARCHAR(45) NOT NULL ,PRIMARY KEY (`users_id`) ,CONSTRAINT `fk_user_roles_users1`FOREIGN KEY (`users_id
tufan
hibernate one-to-many hibernate-mapping target
I am doing a project. I am using hibernate in jboss with maven. However in relation two classes, errors are given. I added two classes to persistence.xml and hibernate.cfg.xml. I did’nt use collection. I used set. But errors are given. Why are errors given? How can I solve this problem?@Entity@EntityListeners({ModelListener.class})@Inheritance(strategy = InheritanceType.SINGLE_TABLE)@DiscriminatorColumn(name = “serviceclass”, discriminatorType =DiscriminatorType.STRING)@ForceDiscriminator// @Dis
True Soft
java hibernate one-to-many
I have a OneToMany relation in hibernate defined like this:@Entity @Table(name = “groups”) public class Group extends BaseModel {// BaseModel defines id as @Id and @GeneratedValue@OneToMany@JoinColumn(name = “group_id”)private List<User> users;// other fields, getters and setters omitted }@Entity @Table(name = “users”) public class User extends BaseModel {@ManyToOne@JoinColumn(name = “group_id”)private Group group;// other fields, getters and setters omitted }Column group_id is in the us
bontade
hibernate spring one-to-many
here are my models. There’s keyInfo in many-to-one relation with userInfo.@Entity @Table(name = “KEY_INFOS”) public class KeyInfo implements Serializable {@Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = “KEY_ID”) private long id;…}@Entity @Table(name = “USER_INFOS”) public class UserInfo implements Serializable {@Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = “USER_ID”) private long id;@Column(name = “NAME”, nullable = false, length=10) private String name
Originally posted 2013-11-27 11:58:30.