relation

JPA map relation entity parentID...

Hello, could someone help me to understand how can I define an entity with JPA mapping that has a relation with it self? For example, my entity is CompanyDivision, divisionA contains divisionB, divisionC and divisionB contains divisionB1, divisionB2 divisionA divisionB divisionB1 divisionB2 d...

When to use memberEnd and when navigableOwnedEnd in an UML class diagram?

I've download a trial of Altova UModel and am starting using UML. As a practical beginning I am modelling a personal information manager application, which includes a web bookmark managing. A Bookmark can belong to many (or no) Tags at once and a Tag can contain many (or no if all the bookmarks it contained were deleted) bookmarks. The ...

Finding recurrence relations of an algorithm

I'm reading my algorithms text book, and I'm reading about recurrence relations and finding the algorithms big O complexity. I run across this line "In the case of the merge-sort algorithm, we get the recurrence equation: t(n) = b if n < 2 = 2t(n/2) +bn if n >= 2 for b > 0 my response was "how ...

getting one to one result from one to many relationship

Hi there , my situation is that i have one to many relation ,like order and orderdetails ,i need to get order which has single order details. ...

Facultative relation with Doctrine ORM

How should be implemented facultative one-to-one relation in Doctrine ORM and Symfony? Suppose there are some folders represented in database. Each folder can have a default icon or some custom icon represented in another table. How should this relation be described in the schema file? How can I tell that in case of given folder relation...

What are the advantages of explicitly setting up relationships inside of a database.

When your creating a database schema and come up with all the foreign keys. What are the advantages of explicitly defining them as such in the database? Are there advantages? If it's reliant MySQL is the db I will be using. ...

Recurrence Relation: Finding Big O

Hello, I am trying to find the big O bound for the following recurrence relation: T(n) = T(n-1) + n^c, where c >= 1 is a constant So I've decided to solve this by using iteration: T(n) = T(n-1) + n^c T(n-1) = T(n-2) + (n-1)^c T(n) = T(n-2) + n^c + (n-1)^c T(n-2) = T(n-3) + (n-2)^c T(n) = T(n-3) + n^c + (n-1)^c + (n-2)^c T(n) = T(n-k...

How to select from database with relations?

Hi, I have database with schema on picture below and I need to select everything related to one row (one id) of [letaky]. That means the related [zamestnanci], every related [obsah] and every [knihy] in it. This is the first time i used relations in database and i have no idea how to make such a select. ...

Defining Status of data via Enum or a relation table

I have an application which has rows of data in a relation database the table needs a status which will always be either Not Submitted, Awaiting Approval, Approved, Rejected Now since these will never change I was trying to decide the best way to implement them I can either think of a Status enum with the values and an int assigned whe...

Writing a recurrence relation for a method

I have a bit of code and need to write a recurrence relation for it. The code simply calculates 2 raised to the nth power. Any help is appreciated. public static int two(int n) { if (n==0) { return 1; } else if (n%2 == 0) { int x = two(n/2); return x*x; } else { return 2 * two(n-1) } ...

How to access joined table attributes in Rails3 ?

I am having trouble accessing the attributes of a join in Rails3. There is two models/tables : Place and Address. One place can have many addresses (i.e. a specific street address, a "corner of" address, etc.). For historical reasons, the tables do not follow standard Rails conventions: class Place < ActiveRecord::Base set_table_name ...

How to ? Storing and retrieving Friends Activities relationship in Events table

Hi everyone, im trying this concept of building a friend system for my application.I have some sucess in designing a database table for storing message a member updates in his profile. This is the table model. Message_id|Message|Message_Author This is the table model to hold further message that belongs to a particular message. F...