Let's say I have two entities Group and User. Evety user can vbe member of many groups and every group can have many users.
@Entity
public class User {
@ManyToMany
Set<Group> groups;
//...
}
@Entity
public class Group {
@ManyToMany(mappedBy="groups")
Set<User> users;
//...
}
Now I want to remove group (let's s...
i have 2 tables
table 1) cid jobtitle
2) pid jobspecif
i want that pid show be forign key in table1
can anyone provide me hibernate mappping for this
...
hi all,
i want to format date to string in hql select, for example i have purchasing data with transaction date in it:
class Purchase {
private Date datePurchase
}
and i want to select date in a certain format, for example yyyyMMdd, can i do that in hql?
actually i can iterate through all purchase data returned by query, and star...
Hey,
I'm trying to figure out how to best use Sessions in (N)Hibernate. I have a C# remoting object (MarshalByRefObject) which gets consumed by an ASP.NET client.
Currently my remoting class opens up one Session instance in the constructor and uses that one for all transactions. Is this a good idea? And would I need a finalizer for the ...
Hi everyone ,
i am new at Java , i got a problem like this ;
i have got a desktop application , there is 2 jComboBox in JFrame.One of this jComboBox is hold Personels from Personel Table and another is take Personel's title.When jComboBox1's selected index changes occurs it will get personelid and fill jComboBox2 with its title.Thats ...
Although obviously not all scenarios can be covered by a single design, is it generally felt now that ORM classes should be passed to and fro between the presentation and business layer (either local or remote), replacing the need for data transfer objects? As far as I can see, using ORM classes presents problems of unnecessary eager loa...
We have business restriction in accessing the database only through stored procedure calls. Caching is also not allowed. Is there value in using Hibernate framework where in you are not using the features like building object relationship based complex queries or caching? We are using considering using the lightweight jdbc option.
...
Hi all,
My form validation works great, but the messages use the JSF component name and not the field label. For instance, I have a field subject and the error message I get when it is empty is something along the lines of:
UIComponent:contactBean.firstName cannot be empty.
My Form:
<div class="field">
<s:decorate id="firstNameDecor...
Let's say I have this entity (for Hibernate):
@Entity
public class Person {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
Long id;
@CollectionOfElements
@IndexColumn("phones_index")
Set<String> phones;
}
For example, I want to get instances of Person where their phones contain "555-1234".
How can I do a ...
Hi All,
I am working on a application which uses hibernate. I am using hibernatebeanreplicator to convert the proxy data from hibernate to null values. I want to just make few variables to null rather than making the whole class null. how can it be achieved.
I am providing an example here.
Class A
{
B b;
}
class B
{
int i;
String...
I have a class called SynonymMapping which has a collection of values mapped as a CollectionOfElements
@Entity(name = "synonymmapping")
public class SynonymMapping {
@Id private String keyId;
//@CollectionOfElements(fetch = FetchType.EAGER)
@CollectionOfElements
@JoinTable(name="synonymmappingvalues", joinColumns={@Joi...
Hi,
I have a domain object say, SalesOrder which has a composite id called id, made of salesOrder id and repid which is contained in another class called SalesOrderID(which is serializable and implements equals and hashcode)
my question is when i want to query SalesOrder,
session.createSQLQuery("FROM SalesOrder where id=:soID")
and so...
Lets say I have two tables - "Cat" and "Cat owner" that are linked with many-to-one like this:
<class name="com.example.Cat" table="cat">
...
<many-to-one name="owner"
class="com.example.CatOwner"
column="owner_id"
not-null="false" insert="true" update="true" cascade="none" lazy="false"/>
</class>
Now I w...
generated="sequence_name" is this correct?
what else must one take care of?
...
ItemTag objects contain an Item object and a Tag object. (These are Java domain objects.)
This simple query works as expected. I get back a list ItemTags and can do all the wonderful things that ItemTags are supposed to do:
def theTags1 = ItemTag.findAll("from ItemTag b")
For example:
println(theTags1[0].tag.tag)
gives me this as...
I'm converting a legacy iBatis implementation to Hibernate, and for backwards compatibility purposes need to present counts of an object's collections rather than the collections themselves. The original query was:
select A.*, ( select count(*) from B where B.A_id = A.id ) as B_count from A;
and b_count would be presented in the resp...
I have figured out that I can use hibernate to get the sum of a number of entities using HQL as follows...
public Long getEnvelopeTotal(AbstractEnvelope envelope) {
String query = "select sum(t.amount) from User_Transaction t";
Long result = (Long) hibernateUtil.getSession().createQuery(query).uniqueResult();
return result;
...
i am geting the following errot when i am tryinh to run my j2ee projrct.
the same project was working before and i started geting this exception now.
i am sure that all class are there along with their mapping files
if i remove mappping of jobtitle from my hibernate.cfg.xml ien the project is running
java.lang.ExceptionInInitializerErr...
I have a column in my SQL-2005 database that used to be a varchar(max), but it has been changed to an nvarchar(max).
Now I need to update my hibernate mapping file to reflect the change, and this is what it used to be:
<element type="text" column="Value"/>
When I try to run the application, the following error appears:
org.hib...
I have a Spring/Hibernate application which I have converted into a web application in order to provide RESTful web services (using Jersey). I am trying to deploy the web application onto Tomcat 6.0.20 and I get only a cryptic error message in the log file:
Jul 8, 2009 2:25:22 PM org.apache.catalina.core.StandardContext start
SEVERE: E...