Environment: Jboss, Mysql, JPA, Hibernate
Our web application will be catering to a large amount of users (~ 1,000,000) and there are a lots of child table where user specific data are stored (e.g. personal, health, forum contributions ...).
What would be the best practice to archive user & user specific information.
[a] Would it be...
Is it possible to create a table that has no 'id'? For example, this is my domain:
class SnbrActVector {
int nid
String term
double weight
static mapping = {
version false
id generator: 'identity'
}
static constraints = {
}
}
When I run this SQL statement, it fails:
insert into snbr_act_...
table A and B need to have 1:M relationship
a and b are added during application runtime, so A created, then say
4 B's created. Each B instance has to come in order, so that I could later
extract them in the same order as I added them.
The app will be a web-app running on Tomcat, so 10 instances may work simultaneously.
So my question...
In these examples on TopLink JPA Annotation Reference:
Example 1-59 @OneToMany - Customer Class With Generics
@Entity
public class Customer implements Serializable {
...
@OneToMany(cascade=ALL, mappedBy="customer")
public Set<Order> getOrders() {
return orders;
}
...
}
Example 1-60 @ManyToOne - Order Cla...
Hi guys, is there a simple way to persist some of the fields in another class and table using hibernate.
For example, I have a Person class with name, surname, email, address1, address2, city, country fields. I want my classes to be:
public class Person
{
private String name;
private String surname;
private String email;
pr...
Hi,I have the following mapping:
Person class mapping:
<hibernate-mapping ...>
<class="my.Person" table="PERSON" where="deleted is null">
...
<sql-delete>
update PERSON set deleted = true where id=?
</sql-delete>
</class>
</hibernate-mapping>
Geek class mapping:
<hibernate-mapping ...>
<joined-subclass name="my.G...
I just wanted to hear the opinion of Hibernate experts about DB schema generation best practices for Hibernate/JPA based projects. Especially:
What strategy to use when the project has just started? Is it recommended to let Hibernate automatically generate the schema in this phase or is it better to create the database tables manually ...
Hello
i am wondering how i would be able to annotate an interface
@Entity
@Table(name = "FOLDER_TABLE")
public class Folder implements Serializable, Hierarchy {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "folder_id", updatable = false, nullable = false)
private int fId;
@Column(name = "folder_name")
private St...
Hibernate 3.5-Final is finally here and it offers the much anticipated JPA2 support, amongst other features. I am working on a project(EJB3 based) using JBoss 5.1.0.GA and Hibernate 3.3, but I wanted to take advantage of the JPA2 and tried to upgrade to Hibernate 3.5.
What I did was fairly simple and standard - I just put all the hibern...
I have an odd problem where Hibernate is running more queries than I've asked for, and can't see the need for.
Here is my controller:
@Autowired UserService users;
@RequestMapping("/test")
@ResponseBody
public String test() {
User user = users.findUser(1L);
return "Found user: "+user.getEmail();
}
Here is the UserService:
@...
I'm following the guide here, but when the DAO executes, the EntityManager is null.
I've tried a number of fixes I found in the comments on the guide, on various forums, and here (including this), to no avail. No matter what I seem to do the EntityManager remains null.
Here are the relevant files, with packages etc changed to protect ...
Hi,
i have two Entities, "Parent" and "Child", that are linked through a bidirectional one-to-many relationship with the cascade attribute set to "all".
When adding a Child object to the Parent children collection using the code below, i can't get the ID of the persisted child until i commit the transaction:
Parent p = (Parent) session....
Hi,
I'm looking for a Generic DAO implementation in Hibernate that includes parent/child relationship management (adding, removing, getting children, setting parents, etc).
Actually the most used generic DAO on the web is the one I found on jboss.org.
And also, i was looking for some DAO/DTO sample implementations and design pattern...
I have entities similar to:
ProductLine: id, name
ProductLineContents: content_id, product_line_id
Content: id, text, updated_time
What I'd like to do is: for each product line, get the latest content (so if theres two content entries associated to one product line, the latest updated_time is rturned, and if one content item is associ...
We have a main mysql database which all of the applications within our organization need the data within this database. How can I config my java web application to use this database with it's specific database when I use Spring and Hibernate within my application? How can I config JPA annotations for example between CONTRACT table within...
Fields in a DB were of type DATETIME (mysql).
Why was it generated as a timestamp and will it be regenerated
during object persistence? That is not a desired scenario in my case,
seeing that as not a timestamp field means that it should only be set via setter,
no generation needed, I dont really understand why it did not generate it...
Hi all,
I am using jasper report to generate a report while calculating total from database.I am sending this as a parameter to jasper.But sometimes it gives wrong values for a total.
I am using Hibernate as a OR-Mapping tool.
In my application i am generating reports from database.In some reports it gives wrong values whereas the cod...
I have a Story entity with the following associations:
Story <1-*> Chapter
Story <1-*> Comment
Story <*-1> User
What is the correct way of removing this entity and handling the all the entities that is referring to? Is there some shorthand way of specifying that associated entities must be handled automatically or is the @PreRemove a...
Hello everyone here is my DAO class :
public class UsersDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(UsersDAO.class);
protected void initDao() {
//do nothing
}
public void save(User transientInstance) {
log.debug("saving Users instance");
try {
...
All what Hibernate reverse engineering generates is something like this
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "column_id")
public Itinerary getColumnId() {
return this.columnId;
}
I want this scenario: when session flushes, first all constructed childs were saved, then the parent object, accord...