Hello,
I have this situtation:
Table1:
tab_id
field11
field12
Table2
id
tab_id
field21
field22
I have to create one object on this two tables for example:
object:
@Id
tabId
@Colummn(name="field11")
field11
@Colummn(name="field12")
field12
@Colummn(name="field21")
field21
When i update field21 table2 should update this f...
I know I have to merge the entity before removing it, but I never thought I have to do it inside EJB. First I have these:
e = (Event) scholarBean.merge(e);
scholarBean.remove(e);
in my managed bean. It give me this error
java.lang.IllegalArgumentException: Entity must be managed to call remove: com.scholar.entity.Event@998, try mergi...
There is this is this table that is being generated on a monthly basis. Basically the table structure of all monthly tables is the same.
Since it would be a lot of work to map the same entity just with a different table name,
Is it possible to change the table name of an entity as follows on runtime since they have the same table struc...
I have few tables like Country,state city which has static data. User do not enter any data in this data. I create pojo for Country, State, City. There are few pojo which has mapping with static data. My requirement is that whenever any request comes to Hibernate for Country (21), it do not hit database but return data from cache . Is th...
Let's say we have an entity object. Is there a way to extract a primary key from it?
I want to do something like this:
public static Object extractPrimaryKey(EntityManager em, Object obj) {
return em.giveMeThePrimaryKeyOfThisEntityObject(obj);
}
Reason for that is to get an attached copy of detached entity:
public static Object ...
I need to write a data provider class to pull data from a sql database for use in a webpage that will display a bing map. Does anyone have a link they could provide with a tutorial on how to do this?
I have very little experience using a db to provide dynamic data for a web page so any help is appreciated. The Database is a sql Azur...
I tried
@ManyToMany(cascade = CascadeType.ALL)
Map<String, Double> data = new HashMap<String, Double>();
but it produces the error :
org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: com.company.Klass.data[java.lang.Double]
at org.hibernate.cfg.annotations.CollectionBinder.bindManyTo...
I am using Websphere application server 7.0.0.0.9 with ;OpenJPA 1.2.3-SNAPSHOT'.
I have Set property of jdbc data source webSphereDefaultIsolationLevel=2 (READ COMMITTED).
I have this question because My understanding is the OptimasticLockException occurs if there is race to commit the same row by multiple thread.
But I think this sit...
Is it possible to configure Hiberate/NHibernate not to use the default constructor to create objects when reading from the database?
When Hibernate reads 10 customers from a table, it creates 10 Customer objects. It does this by
Customer c = new Customer();
Can I tell Hibernate to do the following instead:
Customer c = ACertainStati...
public enum ReportStatus {
SUCCCEED, FAILED;
}
public class Work {
@ElementCollection
@Enumerated(EnumType.STRING)
List<ReportStatus> reportStatuses;
}
Given the following structure, I'd like to perform a query to find all the work filtered by reportStatuses. It works fine with the following hql syntax :
public List<...
Using Hibernate how would you design and implement a search criteria page (which has multiple editable/selectable fields/drop-downs as search criteria) such that queries shouldn't clutter data accessor code. I mean no query-string concatenation based on conditionals and ultimately all the queries should go in a separate xml file. I've do...
I have a question about hibernate.
I want to save a small graph of detached objects :
session.save(new City(1));
Peron p = new Person(new City(1), new Street(2));
session.save(p);
Hibernate told me that city is transient but I do :
session.refresh(city);
session.refresh(street);
session.update(p);
Any Idea?
...
Caused by:
org.hibernate.MappingException: Could not determine type for: controler.Role, for columns: [org.hibernate.mapping.Column(ROLE)]
Can you please help me on this?
this is my mapping class
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hiberna...
Hello..
In my example I have Servers and those Servers belong to a ServerGroup. I am populating a ServerGroup with Servers and saving the ServerGroup. The ServerGroup table is populated but the Servers are not.
public ServerGroupMap()
{
Id(x => x.Id);
Map(x => x.Name);
HasMany(x => x.ServersInGroup)
...
Hello stackoverflow,
I'm currently busy making a Python ORM which gets all of its information from a RDBMS via introspection (I would go with XRecord if I was happy with it in other respects) — meaning, the end-user only tells which tables/views to look at, and the ORM does everything else automatically (if it makes you actually write s...
Do not close this as a duplicate of other questions because I'm not asking the same thing. They're also about a year old. That said, see these links:
http://db.apache.org/jdo/jdo_v_jpa.html
http://www.datanucleus.org/products/accessplatform/jdo_jpa_faq.html
http://www.datanucleus.org/products/accessplatform/persistence_api.html
It se...
I am having trouble working out how to do a bulk delete of a Person object using JPA, when the Person objects contain data stored using an @ElementCollection. Any ideas on how to do this would be much appreciated.
@Entity
@Table(name="at_person")
public class Person implements Comparable<Person> {
@Id
@GeneratedValue(strategy =...
hi
am new and hibernate is driving me crazy full time.
i hv 2 tables one-2-one mapping. when i join only these 2 these two then hibernate is not mapping and when i join table1 with some other table3 then its giving me fine mapped results.
Bean1
private int id ;
private BlessUser blessUser ;
private SnsAuthenticator snsAuth ;
public vo...
Given a set of entity ids, how can you efficiently delete the entities to which to ids represent, without first selecting the entity?
Here is some code, I am using now, but EF profiler is complaining at me for running N+1 queries:
var ids = GetSelectedIds();
foreach (var id in ids)
db.Workshops.DeleteObject(db.Workshop...
Possible Duplicate:
What is NHibernate?
I've heard the name NHibernate used a lot, but I don't really understand what it is. I've read the Wikipedia article, but I don't understand how using NHibernate in my C# applications (desktop w/ WPF, web w/ ASP.NET MVC) will:
Change the code
Be easier/faster
Should I look into using...