Giant NodeManagerLogs from hibernate in weblogic

One of our weblogic 8.1s has suddenly started logging giant amounts of logs and filling the disk. The logs giving us hassle resides in mydrive:\bea\weblogic81\common\nodemanager\NodeManagerLogs\generatedManagedServer1\managedserveroutput.log and the entries in the logfile is just the some kind of entries repeated again and again. Stuff like 19:21:24,470 DEBUG [StdRowLockSemaphore] Lock 'TRIGGER_ACCESS' returned by: LLL-SCHEDULER_QuartzSchedulerThread 19:21:31,923 DEBUG [StdRowLockSemaphore

how to configure hibernate to work with apache cxf

To my application I need to use hibernate with apache cxf. Problem is after I configure hibernate to apache cxf, application didn't start. It gives an error saying it cannot find the LocalSessionFactoryBean class from the springframework (which I used to create the factorySession). I'm new to apache cxf, so it could be an error in my part. Can any of you guys tell me what is the best way to configure hibernate with apache cxf. Thanks in advance

Hibernate Why not to use Spring's OpenEntityManagerInViewFilter

While a lot of posts have been written on the subject of Spring's OpenSession/EntityManagerInViewFilter, I couldn't find any that mentions its flaws. From what I understand, and assuming a typical layered web application architecture using a @Transactional service layer, the filter works as follows: The filter intercepts a servlet request The filter opens an EntityManager and binds it to the current thread Web controller is called Web controller calls service Transaction interceptor begins a n

Hibernate Null values for @CollectionOfElements

I'm mapping a set of attributes to my entity using @CollectionOfElements. The goal here is to be able to provide a meta data list that can be used in a query to pull specific entries. I've figured out the mapping and how to run the queries I want. The problem is that hibernate won't persist null values! @CollectionOfElements() @JoinTable(name = "plan_attribute", joinColumns = @JoinColumn(name = "plan_id")) @MapKey(columns = @Column(name = "attribute_name", nullable = false, lengt

Joda time interval can not be indexed through Hibernate

I have a database table which has two colums together specifying start time and end time of an event. I am using Hibernate to access database and retrieve and store data. My hibernate Model class for this table looks like this. public class EstateViewing implements Comparable<EstateViewing> { private Long id; private Estate estate; private Interval timeInterval; @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "estate_viewing_generator") @Seque

Spring 3 MVC Validation with Hibernate, error after hasErrors?

I am just learning Spring3 Validation with Hibernate. I have this class but I am setting getting the following error org.hibernate.MappingException: Unknown entity: com.stutteringjohnsmith.model.Friend I am doing the sample from but I change the Article to Friend! Please help me out

hibernate where clause with projection

There's a table name STUDENTS with column studentName and studentID I want to run a query like SELECT studentName FROM STUDENTS WHERE studentId ='1'; in hibernate criteria and want to save this result in some String variable

Hibernate The transaction with Spring e Jpa

i have the same problem, my Transactions not write into DB. I think this Spring problem regard is not a bug of framework, but is a problem of configuration file (applicationContext.xml for understand) so I put my configuration file: ... <!-- this is a bridge for entityManager and PersistenceUnit --> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"> <property name="persistenceUnitName" value="fb-p

Hibernate: Repeated column in mapping for entity | two embedded classes of the same type

Hibernate throws an exception when creating the tables, because embedded attributes are mapped to the same column. The class Distance is embedded twice in a class route as followed: @Embeddable public class Distance implements Serializable{ private static final long serialVersionUID = -8466495790824502626L; @Column(nullable = false) protected Integer distInSec; public Distance() { super(); } } @Entity public class Route{ @Column(nullable=false) protected

Hibernate JPA dirty checking

I know that JPA implementors (like Hibernate) monitor the entities attached to the persistence context, and if any field of any entity is changed, then the change is updated to the database. My question is, how does JPA keep track of the changes? The Entities are not intercepted (by proxyies), so for sure it is not throught the interception of the "setters", how is it done? I am interested on the implementation detail of this "dirty checking" feature.

Hibernate could not initialize a collection

i have recs model mapping to a recs table in postgresql, some fields are declared to be Set, when i ran the code, it threw errorr as: org.hibernate.exception.SQLGrammarException: could not initialize a collection: Recs._recsDetailName caused by: org.postgresql.util.PSQLException: ERROR: relation "recs__recsdetailname" does not exist my recs model: @Entity @Table(name = "RECS", uniqueConstraints = @UniqueConstraint(columnNames = "id")) public class Recs implements Serializable, Cloneable {

Hibernate JPQL Selecting Record with Max Value

I'm trying to select the record that has the max value for a particular column and here's what I have so far: select o from Order o where o.orderNumber = :orderNumber and o.version = (select max(o.version) from Order o where o.orderNumber = :orderNumber) This seems to be generating the SQL: SELECT * FROM Order WHERE ordernumber = :orderNumber AND orderversion = (SELECT Max(orderversion) FROM order WHERE order

Hibernate - mapping composite relations to non-primary keys

I have to map a large enterprise database schema. As a number of legacy applications are depending on that schema I can't change it from composite keys to surrogate keys (other than using views with instead-of triggers for ~70% of database objects) which led me to a number of issues I don't know how to overcome. How to map tables that have a surrogate (primary, auto-increment) key and a composite unique key to which a number of tables form a many-to-one relation over the surrogate key, and at

Hibernate MappingException: Could not determine type; Using @Embeddable and @Embedded

I am attempting to move a framework from hibernate3 to 4, this code worked in 3. The framework uses Interfaces to break the tight coupling of classes. Hence: The Entity class is marked with @Entity and this instance uses and an instance of and @Embeddable defined as its interface, a very familiar pattern in Spring. The code works fine in older versions of hibernate (V3), I am moving it to JPA2 and Hibernate 4 I realize that Hibernate would have a difficult time figuring out which implementa

weird error with Hibernate when trying to specify fields to retrieve

I was trying to specify the fields I want in an HQL (select). But when I do this, I keep on getting this weird problem. error message java.lang.NumberFormatException: For input string: "staffId" java.lang.NumberFormatException.forInputString( java.lang.Integer.parseInt( java.lang.Integer.parseInt( javax.el.ArrayELResolver.coerce( javax.el.ArrayELResolver.getValue(

(hibernate4) org.hibernate.MappingException: Unknown entity

I am a newbie to Java EE, please help! The following code used struts2+hibernate4+oracle11g. After I run this code, it gives me this error message: org.hibernate.MappingException: Unknown entity import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; import org.hibernate.service.S

Hibernate JPA - OneToMany association between person and address but cannot create @NamedQuery with association

i am new to hibernate and jpa. Basically i have 2 tables Person and Address. A person can have many address. I have a OnetoMany relationship between person and address. I want to get the firstname and the address of each person. Please find below my 2 tables: ADDRESS: ADDRESSID,ADDRESS,PERSONID PERSON:ID, FIRTSNAME,LASTNAME,PASSWORD. I don't know the syntax about how to create the @NamedQuery for the corresponding sql below: select PERSON.FIRSTNAME, ADDRESS.ADDRESS FROM PERSON INNER JOIN

Hibernate Cascade.ALL from non-owning entity side

I have a @ManyToMany (bi-directional) relationship between Item and Category. class Item { @ManyToMany(cascade = CascadeType.ALL) Collection<Category> categories=new ArrayList<Category>(); } class Category { @ManyToMany(mappedBy="categories", cascade = CascadeType.ALL) Collection<Item> items=new ArrayList<Item>(); } I have specified CascadeType.ALL on both. Item is the owner. ManyToMany relationship would be mapped using a third table (Item_Category) When i

Hibernate createSQLQuery JOIN throws exception

I'm trying to use hibernate to return data from multiple tables of my database. The query works fine on my SQL server, however it does not seem to work in hibernate. Query threadQuery = session.createSQLQuery("SELECT CONCAT(t.lastposter) as lastposter, t.lastpost, t.title, t.threadid, t.lastpostid, t.firstpostid, t.forumid, p.pagetext FROM vbulletin.thread AS t INNER JOIN AS p ON p.postid = t.firstpostid WHERE != 10 AND t.visible = 1 AND t.forumid != 19 AND t.forumid != 20

How to delete superclass entity whose subclass entity has been removed in Hibernate?

There are two entity classes A and B, and instances a, b (a and b have same id). B is subclass of A ( B extends A). I removed an entity "b" from database. Then, I saw that "a" has not been deleted. Actually that s what I really want. However at some point of my code, I want to remove "a" too. But when I do entityManager.remove(a) then it throws exception saying, detached entity can t be removed. It seems removing a subclass entity makes superclass entity detached although superclass entity remai

Spring Boot: Data loading Application wont persist hibernate/JPA

My main aim is to make use of the Spring Boot application infrastructure as much as possible to read a file and persist some objects to the database, after a lot of processing. The problem is that the processing occurs, the DAO is found and an is executed, but no objects are persisted (no hibernate SQL is run). This is my loading tool application (likely to be wrong): @Configuration @EnableAutoConfiguration @ComponentScan(basePackages = {"com.touchcorp.touchpoint"}) @Trans

Why does Hibernate map BIGINT to BigInteger

In most databases a BIGINT is a 64bit integer. Does anyone know why Hibernate maps these to BigInteger instead of Long? I can handle these well but I'm just curious. You can see their default mapping for this type in I even found a hibernate issue but there are no comments indicating why this would be the case. I assume there must be a reason for this choice but I haven't had any success with google. Also, what would be the impact

Hibernate HTTP status 500. java.lang.NullPointerException when I link other page with datatable

Hello I'm newbie in hibernate, PrimeFaces, JSF and Spring. I'm trying make a code that it works. I have, EmpresaDAOImpl, EmpresaServiceImpl, EmpresaBean. This code shows me in screen a datatable with radiobutton in each row and it works. Now I have implemented new classes,, LDiarioDAOImpl, LDiarioServiceImpl and LDIarioBean. Empresa and Ldiario has got a relationship oneToMany. But I don´t know how to make when i push the button in Empresa List goes to other page and s

Hibernate How is c3p0 configured for a hot/warm standby Postgresql server?

I am considering creating a postgresql setup with a hot/warm standby instance so that my application is not affected by a database server downtime, and also to have a fast backup of the main server. I suppose the simplest solution to detect the master would be to change DNS: Application connects to jdbc:postgresql:// points to master's IP If master stops responding, DNS changes to point to backup server 1. In the meantime, b

Equivalent of Hibernate SEQUENCE in Sybase ASE 15.5

I've seen that SEQUENCE is supported in Sybase IQ However is there an alternative in Sybase ASE? This old forum post from 2006 suggests suggests using IDENTITY columns, however I'm wondering if there's a more up to date answer. For context we are supporting multiple database vendors (mainly Oracle) using Hibernate, hence needing to support Sybase as well.

HIbernate returning duplicate or uncompressed objects

I have two entities with oneToMany relationship. Ex: CollegeEntity collegeId, Set students (OneToMany, fetchType.EAGER) StudentEntity student_Id college (ManyToOne) When I query DB using hibernates for a college, its returning me n records of collegeEntity, where n is number of students. I am expecting result of query to be 1 record of collegeEntity with set of size "n" for students. I am using Hibernate - 3.6. My query make use of CollegeId in criteria hibernate to get these records. Pl

getHibernateTemplate save entity with default values

several columns of my entity has default values, now i need to do the insert job. I know i can implement the doInHibernate method and createSqlQuery (e.g. "insert into test (test_column) values(DEFAULT)") to finish it. But is there any way to use getHibernateTemplate().save() to do it?I really don't want to set the columns to be the default values one by one.

Hibernate How to order by computed column in new dto query

I have this query: em.createQuery("select new SomeDto(, " + "(select max(other.weight) from Other other where other.someId = as otherWeight" + ") from Some some order by otherWeight") .getResultList(); Which does not work because hibernate ignores the as otherWeight and simply generates as col_1_0_ instead. Is there any way with this kind of select new dto query to get aliases for columns? If not: how can i do such a query (map result of query to DTO constructor)?

Hibernate What's the best approach to persist form data using Struts 2?

I am developing an application using Struts 2 and Hibernate. On a JSP page I have one form in which all CRUD operations I am performing. I want my Form data to be persisted, which is temporarily entered in the form fields. One approach which I tried is to bind all the data into an Object and store that object in a session or cache but I know there is some limitation of storing data like this. My form is having the functionality to add n number of rows which means I have to store large amount

Best practice to make sure an AUTHENTICATED user is AUTHORISED to access a resource - Spring mvc, Spring Security, Hibernate

We have a spring mvc rest api, utilising spring security and hibernate to a MySql db. We have some roles configured. For example: Standard user: ROLEA Super user: ROLEB Currently to ensure that an authenticated user is authorised to access/update a certain resource we do something like this: Identify the current authenticated user: Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); String activeLogin = authentication.getName(); Identify the login asso

Hibernate uniqueConstraint for two colums (not combined)

My model has following annotation @Table(uniqueConstraints = @UniqueConstraint(columnNames = { "email", "user_name" }) ) My problem is, that this just throws an exception, when the combination of these columns are already taken, but I want an exception when even just one field is already in db. How could I manage this?

Hibernate GRAILS GORM how to update a parent property automatically when saving a child

I have two objects. TimeFrame{ hasMany=[activity:Activity] Date startTime Date endTime Integer activeActivities } Activity{ belongsTo=[timeFrame:TimeFrame] String name String description Date start Date end } Anytime I insert,update, or delete an Activity I want to automatically update the number of activeActivities a timeframe has. But when I add GROM event methods like... def afterUpdate(){ try{ def num=0; def now=new Date(); timeF

Hibernate Grails 3 - prevent unnecessary select statements after controller exits

Please excuse the contrived example. I just can't figure out why these selects are happening. Domain objects: class Author { String name Location location static mapping = { location lazy: true //this is default, but set here to reduce confusion } static constraints = { } } ... class Location { String address static hasOne = [longLat : LongLat] static constraints = { } } ... class LongLat { String longitude String latitude s

Hibernate Add Custom Method to JPARepository with Generics

Assume I have a Entity called Product. I design a Repo as @Repository interface ProductRepository implements JPARepository<Product, Integer>{} This would inherit all the default methods such as save, findAll etc; Now I want to have one custom method, which is also a common method for other entities. I added another interface and implementation interface CustomRepository<T,ID>{ public void customMethod() } class CustomRepositoryImpl implements CustomRepository<T,ID>{ public

Hibernate Interoperability of OSGI and JPA in a JEE environment

We are in the process of deciding whether to use OSGI or not. It is a manifold decision however I have the specific question regarding the interoperability between OSGI and JPA. I read that there are several problems with the combination of both. A detailed description of the issues is described in the presentation of Mike Keith or here. Persistence was another challenging issue. JPA with OSGI required us doubling all classes that were to be used across bundles. This forced us to use i

Hibernate Need help optimizing HQL to reduce columns returned

I have an HQL below: from ProductMain as pm join fetch pm.person as ps join fetch pm.personProduct as pp join fetch pm.personReturn as pr join fetch pp.personObjects as po where in (180,000) and >= :lowRange and <= :highRange It seems when i query the DB i am getting every column back which is getting me a 904 error from DB... Is there any way to get specific columns back to reduce the size of the results? Like if i have 100K results returned with 100 columns each i only

Hibernate org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value did not match expected type java.time.LocalDateTime

I just started to take care of a code developed by other person. It was designed based on Specification pattern using Spring Data and Hibernate. In few words, if I try search using string, boolean or integer fields it works correctly. For instance, when I search/filter with state==SP I got the result and I can see that the diatomite fields are correctly filled in. Also I see hibernate no complaining about invalid data in this case: Copied form my console when I searched succesfully with "state

Hibernate and MariaDB only store timestamps to second precision?

I am trying to store java Dates in a MariaDB using Hibernate. It appears that distinct Dates are treated as identical. For example: new Date(1518458441039) and new Date(1518458441102) are clearly different dates but both cannot be stored in a field declared as unique: 11:09:59.540 [main] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - (conn=502) Duplicate entry '2018-02-12 14:00:41' for key 'UK_plwo79yqbhw7h0yuxbrg5ru7q' javax.persistence.PersistenceException: org.hibernate.exception.C

JPA/Hibernate: select currval on non existing sequence / relation

I have a somehow confusing problem with JPA/Hibernate: a select currval() is performed on a non existing relation/sequence after a value is inserted into the table. I have two similar cases, one works, the other not. Here is the first, non-working version. Entity: @Entity @Table(name = "meter") @Data @EqualsAndHashCode(callSuper = true) public class Meter extends AbstractTimestampEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name =

HIbernate OneToManyLoader executes select for each item in the collection

I'm running a grails app that doesn't support the hibernate fetch mode subselect. Each item in a collection is fetched with a separate select statement. I found this stackoverflow suggestion Hibernate: best practice to pull all lazy collections entity.collection.size()// call size to force hibernate to load the full collection But this causes a separate select for each item in the collection. So, I found a utility class on github written to be a stand-in for grails specifically https://gis

Hibernate How to Prevent Lazy Relationship From Loading

I have a Person entity with a @ManyToOne self-relationship named "manager". In most cases, I do not need to know the Person's manager, so I've marked the relationship with Fetch.LAZY. However, in every case where I retrieve an entity with a Person field, JPA (with Hibernate Provider) loads the referenced Person...and that person's manager...and that person's manager, and so on recursively, until the entire management chain is loaded. All those queries are executed before TypedQuery.get

  1    2   3   4   5   6  ... 下一页 最后一页 共 77 页