Hi,
I want a bidirectional mapping in one class, in which the child can choose its parent (and save it to the database).
How would I model that?
This is what I have:
public class MyNodeMap : ClassMap<MyNode>
{
public MyNodeMap ()
{
Table("myTreeTable");
Id(x => x.Id).Column("NotParentId").GeneratedBy.Ident...
Hi.
I'm trying to generate a database schema for my project using hbm2ddl. I'm using JPA 2 annotations to specify how the schema should look like. Right now I'm having some issues with inherited id's.
I have an abstract super class, let's call it AbstractSuperClass, which looks like this:
@Entity
@Inheritance(strategy=InheritanceType....
How to express the exists clause with JPA?
...
Hello,
I am not sure what I am missing to make a bidirectional onetomany relationship (hibernate engine). A scaled down version of the domain model:
class Person {
@OneToMany(mappedBy="personFrom", cascade = CascadeType.PERSIST)
public List<Relationship> relationships;
}
class Relationship {
@ManyToOne
public Person personFrom;...
I am working on a web application that gets JSON data from the server (Ruby/Rails) into the client using jQuery/ajax and then renders it to the browser using jQuery to populate the DOM. To simplify access to my data on the client side, I would like to use an object-relational mapper similar to ActiveRecord, but which starts with JSON dat...
I got two Entity:
Customer Entity
@Entity
public class Customer {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
@OneToMany(mappedBy="customer", cascade=CascadeType.ALL)
private List<Facility> facilities;
//Setter and Getter for name and facilities
public void addFacility(Facility facil...
Hello,
I am pretty new on the ORM's. I just start to read books and documents about Java Persistence API with Hibernate.
I just wondered, closing EntityManagerFactory is similar with jdbc database connection closing?
Should we close it after every persist/update/delete or not? If we don't close it, will the database connection stay ...
I have a domain object annotated like this for hibernate support.
@Entity
@Table(name = "INPUT")
public class AppInput {
/**
* Unique id for this request
*/
@Id
@GeneratedValue
@Column(name = "INPUT_ID")
private long requestId;
/**
*
*/
@Column(name = "EMAIL_ID")
private String emailId;
/**
*
*/
...
Can someone helps me with some example using haraka librairy?
...
Hi there,
I'm pretty new to hibernate and this is my first posting in here.
I want to create a mapping for a somehow complex scenario and I just don't get it.
I have a 'group' entity where I want to store information about 'orgUnits' and 'divisions', a group member has access to.
One group can contain zero to many orgUnits and the orgU...
I am working on a webapp that interacts with data via XML-RPC rather than with a direct connection to a database. I can execute SQL queries via an XML-RPC methods.
I would like to interact with the data in an ORM framework fashion that has lazy/eager fetching, etc., although I can't seem to figure out how that would be possible with Py...
I've been digging around for an ORM to use in a php/mysql application. However none quite grab my attention past "hello world" tests. So, I decided to do some research and try to code my own custom ORM. However I haven't been able to find resources that explain at code level how to handle db relationships. The concept of how an ORM works...
Hello! I'd like to encapsulate functionality specific to certain models by including methods in the model class definitions. So, for example:
abstract class BaseUser extends DoctrineRecord {
public function setTableDefinition(){
//etc.
}
public function setUp(){
//etc.
}
public functio...
I am working in Padrino and have this in my controller
@work.find_by_id(params[:id])
I want to add prev/next buttons into my view, and so must be able to get the path to the next item on the list. How can I do that with ActiveRecord?
...
This is something that has been pulling at me for a while. Consider a (MVC type) web application with an ORM (e.g. Nhiberate) as the data access layer.
On one hand - the OOP/Rich domain model hand - I feel I should be passing around (references to) the real objects I am talking about.
On the other hand - the DB/Web App hand - I feel ...
One of the many reason to use FluentNHibernate, the new QueryOver API, and the new Linq provider are all because they eliminate "magic string," or strings representing properties or other things that could be represented at compile time.
Sadly, I am using the spatial extensions for NHibernate which haven't been upgraded to support Query...
Hello,
Learning how to write JPA query. Please advise me whether it possible to write the below queries more efficiently, may be in a single select statement. May be a join, but not sure how to do it.
class Relationship {
@ManyToOne
public String relationshipType; //can be MANAGER, CUSTOMER etc
@ManyToOne
public Party party...
I would like to know if it's possible to create a relationship with an entity using hibernate.
In one of my models like:
public Entity associated_model;
public Long associated_model_id;
I would like to establish a relationship table with multiple kind of objects by storing their entry id and a model id or name.
I'm trying to do tha...
Hi, I would just like to know if derived queries can be handled by HQL? I have this bit of code right here and it kept on saying that it did not expect the '(' symbol right after the first FROM keyword. Your help will be much appreciated. Thanks.
"SELECT new " + Distribution.class.getName() + " (adhoc, deployment, design, development, "...
If I have this three structure in a table,
-A
|
*---B
| |
| *---C
| |
| *---D
| |
| *---E
| |
| *---F
| |
| *---G
*---H
*---I
|
*---J
assuming list() method is called and it returns a colleccion of B and H.
In this scenario I would like hibernate obtain C,D,I an...