How should I deal with object hierarchies in a RESTful API?

There’s no reason not to combine these. api.example.com/user/{user_id} – return a user representation api.example.com/channel/{channel_id} – return a channel representation api.example.com/user/{user_id}/channels – return a list of channel representations api.example.com/user/{user_id}/channel_list – return a list of channel ids (or links to their full representations, using the above links) When in doubt, think about how you would display the … Read more

JPA: How to have one-to-many relation of the same Entity type

Yes, this is possible. This is a special case of the standard bidirectional @ManyToOne/@OneToMany relationship. It is special because the entity on each end of the relationship is the same. The general case is detailed in Section 2.10.2 of the JPA 2.0 spec. Here’s a worked example. First, the entity class A: @Entity public class … Read more

Attempt to present UIViewController on UIViewController whose view is not in the window hierarchy

Where are you calling this method from? I had an issue where I was attempting to present a modal view controller within the viewDidLoad method. The solution for me was to move this call to the viewDidAppear: method. My presumption is that the view controller’s view is not in the window’s view hierarchy at the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)