Search Results

Search found 96093 results on 3844 pages for 'confused one'.

Page 10/3844 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • PHP or C# script to parse CSV table values to fill in one-to-many table

    - by Yaaqov
    I'm looking for an example of how to split-out comma-delimited data in a field of one table, and fill in a second table with those individual elements, in order to make a one-to-many relational database schema. This is probably really simple, but let me give an example: I'll start with everything in one table, Widgets, which has a "state" field to contain states that have that widget: Table: WIDGET =============================== | id | unit | states | =============================== |1 | abc | AL,AK,CA | ------------------------------- |2 | lmn | VA,NC,SC,GA,FL | ------------------------------- |3 | xyz | KY | =============================== Now, what I'd like to create via code is a second table to be joined to WIDGET called *Widget_ST* that has widget id, widget state id, and widget state name fields, for example Table: WIDGET_ST ============================== | w_id | w_st_id | w_st_name | ------------------------------ |1 | 1 | AL | |1 | 2 | AK | |1 | 3 | CA | |2 | 1 | VA | |2 | 2 | NC | |2 | 1 | SC | |2 | 2 | GA | |2 | 1 | FL | |3 | 1 | KY | ============================== I am learning C# and PHP, so responses in either language would be great. Thanks.

    Read the article

  • Slow performance of MySQL database on one server and fast on another one, with similar configurations

    - by Alon_A
    We have a web application that run on two servers of GoDaddy. We experince slow preformance on our production server, although it has stronger hardware then the testing one, and it is dedicated. I'll start with the configurations. Testing: CentOS Linux 5.8, Linux 2.6.18-028stab101.1 on i686 Intel(R) Xeon(R) CPU L5609 @ 1.87GHz, 8 cores 60 GB total, 6.03 GB used Apache/2.2.3 (CentOS) MySQL 5.5.21-log PHP Version 5.3.15 Production: CentOS Linux 6.2, Linux 2.6.18-028stab101.1 on x86_64 Intel(R) Xeon(R) CPU L5410 @ 2.33GHz, 8 cores 120 GB total, 2.12 GB used Apache/2.2.15 (CentOS) MySQL 5.5.27-log - MySQL Community Server (GPL) by Remi PHP Version 5.3.15 We are running the same code on both servers. The Problem We have some function that executes ~30000 PDO-exec commands. On our testing server it takes about 1.5-2 minutes to complete and our production server it can take more then 15 minutes to complete. As you can see here, from qcachegrind: Researching the problem, we've checked the live graphs on phpMyAdmin and discovered that the MySQL server on our testing server was preforming at steady level of 1000 execution statements per 2 seconds, while the slow production MySQL server was only 250 executions statements per 2 seconds and not steady at all, jumping from 0 to 250 every seconds. You can clearly see it in the graphs: Testing server: Production server: You can see here the comparison between both of the configuration of the MySQL servers.Left is the fast testing and right is the slow production. The differences are highlighted, but I cant find anything that can cause such a behavior difference, as the configs are mostly the same. Maybe you can see something that I cant see. Note that our tables are all InnoDB, so the MyISAM difference is (probably) not relevant. Maybe it is the MySQL Community Server (GPL) that is installed on the production server that can cause the slow performance? Or maybe it needs to be configured differently for 64bit ? I'm currently out of ideas...

    Read the article

  • Nhibernate one-to-many with table per subclass

    - by Wayne
    I am customizing N2CMS's database structure, and met with an issue. The two classes are listed below. public class Customer : ContentItem { public IList<License> Licenses { get; set; } } public class License : ContentItem { public Customer Customer { get; set; } } The nhibernate mapping are as follows. <class name="N2.ContentItem,N2" table="n2item"> <cache usage="read-write" /> <id name="ID" column="ID" type="Int32" unsaved-value="0" access="property"> <generator class="native" /> </id> <discriminator column="Type" type="String" /> </class> <subclass name="My.Customer,My" extends="N2.ContentItem,N2" discriminator-value="Customer"> <join table="Customer"> <key column="ItemID" /> <bag name="Licenses" generic="true" inverse="true"> <key column="CustomerID" /> <one-to-many class="My.License,My"/> </bag> </join> </subclass> <subclass name="My.License,My" extends="N2.ContentItem,N2" discriminator-value="License"> <join table="License" fetch="select"> <key column="ItemID" /> <many-to-one name="Customer" column="CustomerID" class="My.Customer,My" not-null="false" /> </join> </subclass> Then, when get an instance of Customer, the customer.Licenses is always empty, but actually there are licenses in the database for the customer. When I check the nhibernate log file, I find that the SQL query is like: SELECT licenses0_.CustomerID as CustomerID1_, licenses0_.ID as ID1_, licenses0_.ID as ID2_0_, licenses0_1_.CustomerID as CustomerID7_0_, FROM n2item licenses0_ inner join License licenses0_1_ on licenses0_.ID = licenses0_1_.ItemID WHERE licenses0_.CustomerID = 12 /* @p0 */ It seems that nhibernate believes that the CustomerID is in the 'n2item' table. I don't know why, but to make it work, I think the SQL should be something like this. SELECT licenses0_.ID as ID1_, licenses0_.ID as ID2_0_, licenses0_1_.CustomerID as CustomerID7_0_, FROM n2item licenses0_ inner join License licenses0_1_ on licenses0_.ID = licenses0_1_.ItemID WHERE licenses0_1_.CustomerID = 12 /* @p0 */ Could any one point out what's wrong with my mappings? And how can I get the correct licenses of one customer? Thanks in advance.

    Read the article

  • JavaScript Collection of one-line Useful Functions

    - by Wilq32
    This is a question to put as many interesting and useful JavaScript functions written in one line as we can. I made this question because I'm curious how many people around like the art of one-Line programming in JavaScript, and I want to see their progress in action. Put variations of each code inside comments.

    Read the article

  • Linq-to-sql Add item and a one-to-many record at once

    - by Oskar Kjellin
    I have a function where I can add articles and users can comment on them. This is done with a one to many relationship like= "commentId=>ArticleId". However when I try to add the comment to the database at the same time as I add the one to many record, the commentId is not known. Like this code: Comment comment = new Comment(); comment.Date = DateTime.UtcNow; comment.Text = text; comment.UserId = userId; db.Comments.InsertOnSubmit(comment); comment.Articles.Add(new CommentsForArticle() { ArticleId = articleId, CommentId = comment.CommentId }); The commentId will be 0 before i press submit. Is there any way arround not having to submit in between or do I simply have to cut out the part where I have a one-to-many relationship and just use a CommentTable with a column like "ArticleId". What is best in a performance perspective? I understand the underlying issue, I just want to know which solution works best.

    Read the article

  • Python many-to-one mapping (creating equivalence classes)

    - by Adam Matan
    Hi, I have a project of converting one database to another. One of the original database columns defines the row's category. This coulmn should be mapepd to a new category in the new databse. For example, let's assume the original categories are:parrot, spam, cheese_shop, Cleese, Gilliam, Palin Now that's a little verbose for me, And I want to have these rows categorized as sketch, actor - That is, define all the sketches and all the actors as two equivalence classes. >>> monty={'parrot':'sketch', 'spam':'sketch', 'cheese_shop':'sketch', 'Cleese':'actor', 'Gilliam':'actor', 'Palin':'actor'} >>> monty {'Gilliam': 'actor', 'Cleese': 'actor', 'parrot': 'sketch', 'spam': 'sketch', 'Palin': 'actor', 'cheese_shop': 'sketch'} That's quite awkward- I would prefer having something like: monty={ ('parrot','spam','cheese_shop'): 'sketch', ('Cleese', 'Gilliam', 'Palin') : 'actors'} But this, of course, sets the entire tuple as a key: >>> monty['parrot'] Traceback (most recent call last): File "<pyshell#29>", line 1, in <module> monty['parrot'] KeyError: 'parrot' Any ideas how to create an elegant many-to-one dictionary in Python? Thanks, Adam

    Read the article

  • CEIL is one too high for exact integer divisions

    - by Synetech
    This morning I lost a bunch of files, but because the volume they were one was both internally and externally defragmented, all of the information necessary for a 100% recovery is available; I just need to fill in the FAT where required. I wrote a program to do this and tested it on a copy of the FAT that I dumped to a file and it works perfectly except that for a few of the files (17 out of 526), the FAT chain is one single cluster too long, and thus cross-linked with the next file. Fortunately I know exactly what the problem is. I used ceil in my EOF calculation because even a single byte over will require a whole extra cluster: //Cluster is the starting cluster of the file //Size is the size (in bytes) of the file //BPC is the number of bytes per cluster //NumClust is the number of clusters in the file //EOF is the last cluster of the file’s FAT chain DWORD NumClust = ceil( (float)(Size / BPC) ) DWORD EOF = Cluster + NumClust; This algorithm works fine for everything except files whose size happens to be exactly a multiple of the cluster size, in which case they end up being one cluster too much. I thought about it for a while but am at a loss as to a way to do this. It seems like it should be simple but somehow it is surprisingly tricky. What formula would work for files of any size?

    Read the article

  • My files disappeared from the UbuntuOne synced folder

    - by Junji
    I set up an UbuntuOne account on PC1 (Ubuntu 10.10) and the same account on PC2 (Ubuntu 10.04). I did the following: Created file named maverick.txt in PC1's ~/Ubuntu One/log Created file named venus.txt in PC2's ~/Ubuntu One/log Bot files appeared in one.ubuntu.com A few hours later, those two files are disappeared from PC1's Ubuntu One/log PC2's Ubuntu One/log one.ubuntu.com So, my files are gone forever. Why did this happen? Is there any way to recover those files?

    Read the article

  • 2 VB Scripts one to remove Default Gateway and one to add a Default Gateway

    - by Tom
    Hello everyone, I have a client with a bunch of children using about 30 machines on a regular basis. All machines that the children user are set with Static IP Addresses. The machines that the kids use, I would like to be able to run a script that will remove the default gateway so they cant get to the Internet. Then I need another that will add the Default gateway, so Windows and software updates can be run. Both scripts need to use the domain admin account for permissions Any help would be greatly appreciated

    Read the article

  • Connect three computers (including one laptop) to one monitor

    - by Jesse Beder
    I have the following hardware: 2 Desktop PCs, running Windows XP and Ubuntu Macbook Pro a LCD monitor, a wired keyboard, and a wired mouse Currently, I'm using an oldish IOGear KVM switch to connect the two PCs to the input/output (and it works very well). I'd like a setup that includes the laptop as well, ideally maintaining as much portability as possible (meaning I'd like to be able to sit down, easily plug in my laptop, work on all computers, then easily pick up and leave with the laptop - is docking station the right word here?). What hardware do I need to do this?

    Read the article

  • One network, two macbooks, one is fast and the other is slow

    - by Brendan
    I really need help for my friend. I know next to nothing about computers. My roommate and I both have macbook pros from the same year running OS X, are both connecting wirelessly to the same xfinity wifi, and while mine runs perfectly fine, my roommate complains that his works very slowly and times out every few seconds. I can't seem to figure out why this is. He is trying to get me to switch internet providers because he is convinced that it is their problem, but this cannot possibly be the issue since it works great on mine. He has an xbox hooked up to the wifi that he says also works poorly. I really can't see switching providers given that I am experiencing absolutely zero problems. How can I help my friend?

    Read the article

  • Forward one RDP port on one machine to multiple external users at the same time

    - by matnagel
    We have a windows server 2003 machine with rdp service listening on the standard port 3389. For security reasons this port is not opened on the router, but we have freesshd service running and a remote admin can login via ssh and this port is forwarded to external port 33001 for the first external user. This works great. Now we have another admin who wants to work remote (he uses a different windows account, but needs to work on the same machine.) So this is basically a ssh port forwarding question. Will the other user be able to login at the same time using the same port 33001 ? Please keep in mind that there will be a second tunnel, and this second tunnel will also use the local port 3389 on the windows server.

    Read the article

  • One SSL certificate (one domain) for two servers ?

    - by marioosh.net
    I have two servers. On SERVER1 i have configured SSL certificate (on Apache) for domain https://somedomain.com. I need to connect to my working domain some app that exists on remote server SERVER2 - working app for example: https://remoteapps.com/remoteApp. I used mod_proxy to do it, but SSL certificate doesn't work. ProxyPass /remoteApp https://remoteapps.com/remoteApp ProxyPassReverse /remoteApp https://myapp.com/remoteApp How to make certificate for https://somedomain.com/remoteApp work too ?

    Read the article

  • Use one home directory for more than one operating system

    - by Just Jake
    I want to configure the same user account across multiple operating systems. Right now, I'm set up for general use in Mac OS 10.6.6 "Snow Leopard," and I have about 200gb of files in my home directory (/Users/justjake/). I want to use this user (and home directory) for other operating systems on other partitions. For example, I have Mac OS 10.5 installed on a 12gb partition. How can I share permissions, user accounts across my two operating systems? Would moving the my /Users directory from 10.6 to it's own partition then mounting it using /etc/fstab solve my issue?

    Read the article

  • asp.net-mvc feature - one css file per (view / master-page / user-control)

    - by Mendy
    I'm trying to implement the following feature: I want just one css file to be attached for any page that I rendered. For example take StackOverflow site. For the questions page, we will have questions.css file. so.com/questions ---> questions.css so.com/question/1234/title ---> question.css so.com/about ---> about.css so.com/faq ---> faq.css Now, I know that this css files share code in common, because they may have the same MasterPage(s) / UserControls. So, the solution need to take into account MasterPages, views and usercontrols as well. So, what will be the right solution for this kind of problem? I'm thinking about one solution, I'll put is as an answer, but maybe you have a better solution for this?

    Read the article

  • Always use one slow connection in preference of a "faster" one

    - by billc.cn
    In Windows, there's this automatic metric thing where the metric is selected according to the declared speed of the link. I now have a gigabit LAN routed to a 2MB DSL service and a HSDPA mobile broadband connection. The former is always chosen for Internet packets even though the latter is actually faster. I tried setting the mobile broadband's interface metric to 1 and raising its priority in the advanced settings of the adapter settings, but this does not seem to affect the metric of the default route. The default route to the Ethernet interface always have a lower metric than the mobile broadband interface. Am I missing something here?

    Read the article

  • Burn more than one ISO to one dvd?

    - by Doug
    I just turned 11 CDs with a total of 1gb of stuff into ISOs. Is it possible for me to just burn all the ISO videos into a DVD? Any alternative way for me to do it? Edit: I need to be playable on any DVD player. It's videos for my grandparents. Update: I read that DVD shrink should work (re-authoring software), but I didn't try it because when I imported the VIDEO_TS folders into the software, my video wasn't played widescreen, and I dont' know how to fix it.

    Read the article

  • unique constraint (w/o Trigger) on "one-to-many" relation

    - by elgcom
    To illustrate the problem, I make an example: A tag_bundle consists of one or more than one tags. A unique tag combination can map to a unique tag_bundle, vice versa. tag_bundle tag tag_bundle_relation +---------------+ +--------+ +---------------+--------+ | tag_bundle_id | | tag_id | | tag_bundle_id | tag_id | +---------------+ +--------+ +---------------+--------+ | 1 | | 100 | | 1 | 100 | +---------------+ +--------+ +---------------+--------+ | 101 | | 1 | 101 | +--------+ +---------------+--------+ There can't be another tag_bundle having the combination from tag 100 and tag 101. How can I ensure such unique constraint when executing SQL "concurrently"!! that is, to prevent concurrently adding two bundles with the same tag combination Adding a simple unique constraint on any table does not work, Is there any solution other than Trigger or explicit lock. I come to only this simple way: make tag combination into string, and let it be unique. tag_bundle (unique on tags) tag tag_bundle_relation +---------------+--------+ +--------+ +---------------+--------+ | tag_bundle_id | tags | | tag_id | | tag_bundle_id | tag_id | +---------------+--------+ +--------+ +---------------+--------+ | 1 | 100,101| | 100 | | 1 | 100 | +---------------+--------+ +--------+ +---------------+--------+ | 101 | | 1 | 101 | +--------+ +---------------+--------+ but it seems not a good way :(

    Read the article

  • Hibernate Many-To-One Foreign Key Default 0

    - by user573648
    I have a table where the the parent object has an optional many-to-one relationship. The problem is that the table is setup to default the fkey column to 0. When selecting, using fetch="join", etc-- the default of 0 on the fkey is being used to try over and over to select from another table for the ID 0. Of course this doesn't exist, but how can I tell Hibernate to treat a value of 0 to be the same as NULL-- to not cycle through 20+ times in fetching a relationship which doesn't exist? <many-to-one name="device" lazy="false" class="Device" not-null="true" access="field" cascade="none" not-found="ignore"> <column name="DEVICEID" default="0" not-null="false"/>

    Read the article

  • Cannot connect Nexus One Phone to Android adb

    - by appbee
    I am running Android SDK 2.2 and am trying to get the adb to connect to the Google Nexus One phone. Its a new phone, shipped straight from Google - haven't installed any apps on it yet. (I have Windows XP) Here is what I have done so far: Followed the instructions on setting up the device for development as given on the Android Developer's site: http://developer.android.com/guide/developing/device.html added android:debuggable="true" to my application manifest USB debuggable is checked on the phone downloaded the Device Drivers For Windows Revision 3 (this supports Nexus One phones) Went through the Hardware Installation wizard to install the device - the device shows up as "Android Composite ADB Interface". When I run adb devices on the shell, the device appears for a moment, then disappears. On the Eclipse console, I get the following message: [2010-11-13 11:54:42 - DeviceMonitor]Failed to start monitoring I have rebooted the pc several times, uninstalled and reinstalled the drivers several times, but I get the same error each time. As I was researching this problem, someone had recommended rebooting the phone. I am a bit confused by that - is that a soft or hard reboot? Do I just power the phone off/on and is there something more complex involved? Do I have to hard reboot it to reset to factory version - even though its brand new? Has anyone run into a similar problem? Any help on this would be great. I can't test my application on the device if the adb cannot view the device. Thanks so much in advance.

    Read the article

  • Nexus One & Windows XP USB Driver

    - by Stefan
    I've been unable to get my Nexus One working as a development phone on Windows XP. I've got the driver (revision 3 for N1 support), I've got it installed according to the official installation guide, and the phone appears in the Device Manager just as the guide says it should. However, adb still can't find the phone. 'adb devices', for example, returns no active devices. Am I forgetting some basic step? One thing I've noticed is that the driver is labeled in Windows as version 2 released November, 2009 (I need version 3 from January 2010 for N1 support). However, I've never had version 2 installed. I've used the SDK to download version 3 several times - even deleted it and redownloaded it. I've uninstalled/reinstalled the version 3 driver multiple times. It still says version 2. Is this the problem, or this something completely unrelated? Note: The phone is working as a dev phone on Ubuntu, so I know the phone/cable/etc. are good. It's either my fault or the driver's.

    Read the article

  • Hibernate mapping one-to-many problem

    - by Xorty
    Hello, I am not very experienced with Hibernate and I am trying to create one-to-many mapping. Here are relevant tables: And here are my mapping files: <hibernate-mapping package="com.xorty.mailclient.server.domain"> <class name="Attachment" table="Attachment"> <id name="id"> <column name="idAttachment"></column> </id> <property name="filename"> <column name="name"></column> </property> <property name="blob"> <column name="file"></column> <type name="blob"></type> </property> <property name="mailId"> <column name="mail_idmail"></column> </property> </class> </hibernate-mapping> <hibernate-mapping> <class name="com.xorty.mailclient.server.domain.Mail" table="mail"> <id name="id" type="integer" column="idmail"></id> <property name="content"> <column name="body"></column> </property> <property name="ownerAddress"> <column name="account_address"></column> </property> <property name="title"> <column name="head"></column> </property> <set name="receivers" table="mail_has_contact" cascade="all"> <key column="mail_idmail"></key> <many-to-many column="contact_address" class="com.xorty.mailclient.client.domain.Contact"></many-to-many> </set> <list name="attachments" cascade="save-update, delete" inverse="true"> <key column="mail_idmail" not-null="true"/> <index column="fk_Attachment_mail1"></index> <one-to-many class="com.xorty.mailclient.server.domain.Attachment"/> </list> </class> </hibernate-mapping> In plain english, one mail has more attachments. When I try to do CRUD on mail without attachments, everyting works just fine. When I add some attachment to mail, I cannot perform any CRUD operation. I end up with following trace: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133) at domain.DatabaseTest.testPersistMailWithAttachment(DatabaseTest.java:355) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: java.sql.BatchUpdateException: Cannot add or update a child row: a foreign key constraint fails (`maildb`.`attachment`, CONSTRAINT `fk_Attachment_mail1` FOREIGN KEY (`mail_idmail`) REFERENCES `mail` (`idmail`) ON DELETE NO ACTION ON UPDATE NO ACTION) at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1666) at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1082) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268) ... 27 more Thank you

    Read the article

  • Hibernate annotated many-to-one not adding child to parent Collection

    - by Rob Hruska
    I have the following annotated Hibernate entity classes: @Entity public class Cat { @Column(name = "ID") @GeneratedValue(strategy = GenerationType.AUTO) @Id private Long id; @OneToMany(mappedBy = "cat", cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Set<Kitten> kittens = new HashSet<Kitten>(); public void setId(Long id) { this.id = id; } public Long getId() { return id; } public void setKittens(Set<Kitten> kittens) { this.kittens = kittens; } public Set<Kitten> getKittens() { return kittens; } } @Entity public class Kitten { @Column(name = "ID") @GeneratedValue(strategy = GenerationType.AUTO) @Id private Long id; @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Cat cat; public void setId(Long id) { this.id = id; } public Long getId() { return id; } public void setCat(Cat cat) { this.cat = cat; } public Cat getCat() { return cat; } } My intention here is a bidirectional one-to-many/many-to-one relationship between Cat and Kitten, with Kitten being the "owning side". What I want to happen is when I create a new Cat, followed by a new Kitten referencing the Cat, the Set of kittens on my Cat should contain the new Kitten. However, this does not happen in the following test: @Test public void testAssociations() { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); Transaction tx = session.beginTransaction(); Cat cat = new Cat(); session.save(cat); Kitten kitten = new Kitten(); kitten.setCat(cat); session.save(kitten); tx.commit(); assertNotNull(kitten.getCat()); assertEquals(cat.getId(), kitten.getCat().getId()); assertTrue(cat.getKittens().size() == 1); // <-- ASSERTION FAILS assertEquals(kitten, new ArrayList<Kitten>(cat.getKittens()).get(0)); } Even after re-querying the Cat, the Set is still empty: // added before tx.commit() and assertions cat = (Cat)session.get(Cat.class, cat.getId()); Am I expecting too much from Hibernate here? Or is the burden on me to manage the Collection myself? The (Annotations) documentation doesn't make any indication that I need to create convenience addTo*/removeFrom* methods on my parent object. Can someone please enlighten me on what my expectations should be from Hibernate with this relationship? Or if nothing else, point me to the correct Hibernate documentation that tells me what I should be expecting to happen here. What do I need to do to make the parent Collection automatically contain the child Entity?

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >