Hi all, i have some questions about interaction with hibernate.
openSession or getCurrentSession (without jta, thread insted)?
How mix session operations with swing gui? Is good have something like this in a javabean class?
public void actionPerformed(ActionEvent event) {
// session code
}
Can i add methods to my entities that c...
Dear All:
I have implemented a back-end for my application in Groovy/Gradle, and am now trying to implement a GUI.
I am using Hibernate for my data storage (with HSQLDB) per
http://groovy.codehaus.org/Using+Hibernate+with+Groovy
(with Jasypt for encryption) and it is working quite well.
I was wondering if there are any good tips for ...
This error is driving me nuts!!!
Caused by: java.lang.NoSuchMethodException: com.mksoft.fbautomate.domain.Account$Type.values()
The same exact class works fine in a separate Groovy file.
Any ideas/help much appreciated.
Most confusing...
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Enum.html
has no values() method!
Here is m...
Dear All:
Using the following code:
@Entity
@Table(uniqueConstraints=[@UniqueConstraint(columnNames=["account","name"])])
class Friend {
@Id @GeneratedValue(strategy=GenerationType.AUTO)
public Long id
@ManyToOne
public Account account
public String href
public String name
}
I get the following error:
org.hibernate.Anno...
I have defined a collection in Hibernate like this:
...
public class Item {
...
@ElementCollection
List<Object> relatedObjects;
}
It creates a mapping table with colums item_id and object_id.
The problem is that object_id seems to be unique. In other words I can not have two different items being related to the same objec...
Hello,
I have a class mapped as an Entity to persist it in a database. I have an id field as the primary key so every time the object is persisted the value of the id is retrieved from the sequence "myClass_pk_seq", a code like the following one.
@Entity
@Table(name="myObjects")
public class MyClass {
@Id
@GeneratedValue(strate...
I'm usign @GeneratedValue(strategy = GenerationType.AUTO) to generate and id on my entity.
I don't now how it works, but on my chils table, generates id values, that follow the parent sequence.
//parent table
@Entity
@Table(name="parent")
public class Parent {
@Id
@GeneratedValue(strategy = GenerationType....
I am trying to create a Eclipse project from Hibernate tutorials under path
\hibernate-distribution-3.5.3-Final\project\tutorials\eg
using command line mvn eclipse:eclipse. But i am getting this error
Reason: POM 'org.jboss.maven.plugins:maven-jdocbook-style-plugin' not found in repository: Unable to download the artifact from any repos...
I'm having trouble with a JPA/Hibernate (3.5.3) setup, where I have an entity, an "Account" class, which has a list of child entities, "Contact" instances. I'm trying to be able to add/remove instances of Contact into a List<Contact> property of Account.
Adding a new instance into the set and calling saveOrUpdate(account) persists every...
I would like to add a value object to a mapped class where one column is fixed depending of the class that contains the component. How can I do something like this?
<component name="aComponent">
<property name="abc" column="cde"/>
<property name="xyz" value="FIXED"/>
</component>
Unfortunatly, the value attribute does not exist. I...
Hi.
I have problems creating a custom query.
This is what entities:
@Entity
public class ApplicationProcess {
@CollectionOfElements
private Set defaultTemplates;
//more fields
}
And Template.java
@Embeddable
@EqualsAndHashCode(exclude={"used"})
public class Template implements Comparable<Template> {
@Setter priv...
I'm attempting to get a Spring 3.0.2 WebMVC project running with the new annotated validation support. I have a Hibernate entity annotated like this:
@Entity
@Table(name = "client")
public class Client implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = ...
I write an Test Java APP and it works right BUt this Web app throws an exception like that with to same cfg.xml file
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.connection.autocommit">true</property>
<property name="hibernate.connection.release_mode">auto</property>
<property n...
The below code functions, but Hibernate never lets go of its grip of any object. Calling session.clear() causes exceptions regarding fetching a joined class, and calling session.evict(currentObject) before retrieving the next object also fails to free the memory. Eventually I exhaust my heap space.
Checking my heap dumps, StatefulPersis...
Hi,
can Hibernate generate uppercase SQL?
I.e. some option which would make it send
SELECT table1_.prop1_ FROM my_table AS table1_;
instead of current
select table1_.prop1_ from my_table as table1_;
which I consider far less readable, esp. for long queries HBN tends to spit.
See also https://forum.hibernate.org/viewtopic.php?f=1&...
I'm just wondering if it's possible for 'createCriteria' to specify the contains group similar to CharIndex('P', Channel) <> 0
I am using eq and get exact match but what should i use in i need to get all the records which contains channel similar to IN("channel",('a','b','c','d'))
def c = Load.createCriteria()
def results = c {
...
It's possible to override LAZY in HQL using LEFT JOIN FETCH.
FROM Obj AS obj LEFT JOIN FETCH obj.otherObj WHERE obj.id = :id
Is it also possible to override EAGER? How?
...
Hi all, i have relationship:
// In A.java class
@OneToMany(mappedBy="a", fetch=FetchType.LAZY)
@Cascade(CascadeType.SAVE_UPDATE)
private List<B> bList;
// In B.java class
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="id_a")
@Cascade(CascadeType.SAVE_UPDATE)
private A a;
Now look this:
A a=new A();
// setting A
B b=new B();
// ...
I have a Project entity and a Group entity. I can get a Project by name using the following getter method from DAO:
public Project getProject(String name){
Project project = null;
DetachedCriteria criteria = DetachedCriteria.forClass(Project.class);
criteria.add(Restrictions.eq("name", name));
List<Project> projects = g...
I have the following relationship:
// In A.java class
@OneToMany(mappedBy="a", fetch=FetchType.LAZY)
@Cascade(CascadeType.SAVE_UPDATE)
private List<B> bList;
// In B.java class
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="id_a")
@Cascade(CascadeType.SAVE_UPDATE)
private A a;
I get this exception:
StaleStateException: Batch upd...