Hi,
The problem looks like this:
A Product table. 3 joined-subclasses: DVD, CD, Book.
A Role table (composite id: NAME, ROLE, PRODUCT), and subclasses by discriminator column ROLE: actor, director, artist, author, etc.. which are mapped to Actor, Director, Artist, Author java classes; (pretty usual I guess) ...
A Book has authors, a C...
Hi,
It's the first time I use Subsonic.
Let say I have those classes :
public class Store
{
public int Id { get; set; }
public String Name { get; set; }
}
public class Employee
{
public int Id { get; set; }
public String Name { get; set; }
}
An employee is related to a store with is hired date. This means that in th...
In this document (scroll down to the Unidirectional section):
http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#entity-mapping-association-collections
it says that a unidirectional one-to-many association with a join table is much preferred to just using a foreign key column in the owned entity. My question i...
I’m not sure if this has already been asked – I looked around for quite a bit but couldn’t find anything.
My end result is to get data from several of my SQL database tables into a comma delimited flat file. Normally this would not be a problem but due to their many to one relationship and the format I’m forced to put it in it’s proving...
Hi!
How do I handle relations in SubSonic 3 using the SimpleRepository? E.g: Having Author and Book (see below) I want the assigned Author to be persisted when the Book is persisted.
[Serializable]
public class Book
{
public int Id { get; set; }
public string Title { get; set; }
public Author Author { get; set; }
}
[Serial...
I have a problem with one-to-many relationships. I have the following domain classes:
public class Installation : Entity<Installation>
{
public virtual string Name { get; set; }
public virtual IList<Institution> Institutions { get; set; }
public Installation()
{
Institutions = new List<Institution>();
...
I'm a total Ruby/Rails/AR noob. I have a very basic sort of database schema that I can't seem to figure out the best way to represent in the Rails Way.
Table Post
String title, author
Text content
Timestamp posted
Post parent
The idea here is that top level posts will have parent that is NULL. Every response will hav...
I have a one-to many relationship in Rails:
class User < ActiveRecord::Base
has_many :activities, :order => "added_at DESC"
class Activity < ActiveRecord::Base
belongs_to :user
I have a method in Activity:
def self.test_message(user, message)
user.activities << Activity.create do |activity|
activity.message = message
...
Typical usage scenario:
I have master, branch_foo and branch_bar. All are up to date. Now, I do a "git checkout master" and work on a bug fix.
Lets say that fix was on a tracked file that is in the same state on all branches - ie. before the fix, a diff of the file from each branch results in no differences.
Is there a way to commit...
I have two separate databases that contain a report and reportItems table. The table structure is the same for both databases.
I have a session bean that needs to write to each database / table. In order to keep the code simple I want the session bean to work with a base entity bean that then goes to the appropriate table.
To accomplis...
I have 2 views in SQL set up:
PurchaseOrder
PurchaseOrderLineItems
These have many columns aliased (the tables they view/join are not sensibly named... it's a 3rd party product)
I have 2 classes (simplified below)
class PurchaseOrder
{
public string PoNumber { get; set; }
public string Vendor { get; set; }
...
In this JPA example there is a code:
@OneToOne(cascade=CascadeType.ALL)
private Deity mother;
@OneToOne(cascade=CascadeType.ALL)
private Deity father;
@OneToMany(cascade=CascadeType.ALL)
private Set<Deity> children;
Why relation with father and mother is implemented by @OneToOne annotation and not in @ManyToOne relation? If Child an...
I had a following structure:
User has many books in his history
which was translated to the following
class User { ICollection<Book> History } // C#
User -> UserHistory (UserId, BookId) -> Book // DB
Now I want to add a date to the history, creating the following class structure:
class User { ICollection<Read> History }
...
I'm looking for possible ways to persist the following classes. Subsonic SimpleRepository looks like it might work, and people have said it should, when I asked a more general question.
But I've been unable to find a single example of how to do this - or at least one I could understand.
Can anyone point me to an example, or tell me ...
Hello folks,
I am getting this exception when mapping one-to-many relation. my mapping xml looks like this:
<set name="-----" generic="true" inverse="true" cascade="all" lazy="false">
<key column="Id" />
<one-to-many class="-----------,---------" />
</set>
And,
<many-to-one name="------" column="Id" not-null="true" cla...
The following code throws a StaleStateException exception when the Order.OrderItems property (an IList) is Commited. The full text of the exception is:
An unhandled exception of type 'NHibernate.StaleStateException' occurred in NHibernate.dll
Additional information: Unexpected row count: 0; expected: 1
I've just started using NHibern...
Hi, I have a relatively simple one-to-many relationship and use acts_as_tree to get it organized in the view. It kinda looks like this:
Root
|_Product 1
|_Product 2
|_Category 1.1
|_Product 3
|_Product 4
|_Category 1.1.1
|_Product 5
The way I set it up is that I list products in the 'sh...
When trying to save an ID from my parent class into a child class, I keep getting the error
"ERROR - Field 'parent_id' doesn't have a default value"
I have tried all types of mappings. I am using annotations.
Any help on this would be appreciated
Parent:
@Id
@Column(name="id")
@GeneratedValue(strategy=GenerationTyp...
Hey everyone,
I'm trying to design a pretty simple app and am getting myself a bit confused with Hibernate's definition of entity and value objects (as defined in Chapter 4 of Java Persistence with Hibernate).
What I have is an app with customers, who can place orders (one to many relationship). Each of these orders has many order line...
Hi,
I have created model which you can see there:
http://i.imagehost.org/0836/2009-11-08%5F14%5F37%5F41.png
I want to store information about sound categories and some sample sounds for each category.
Category has Name (NSString) and SoundsRelation (NSSet of NSData, which represents sounds).
Here is the problem:
For example I have som...