jpa

Hibernate JPA, MySQL and TinyInt(1) for Boolean instead of bit or char

Hi Here is my JPA2 / Hibernate definition: Code: @Column(nullable = false) private boolean enabled; In MySql this column is resolved to a bit(1) datatype - which does not work for me. For legacy issues I need to map the boolean to a tinyint not to a bit. But I do not see a possibility to change the default datatype. Is there any? ...

Entity Manager / persistance file structure

hi all, The title isnt clear as i couldnt think of one but, i have an EJB project and am trying to play with JPA. To create the entity manager i am injecting it in via anotations @PersistenceContext(unitName="testConnection") private EntityManager em; when i run a test qurey which i belive to be fine Query userQuery = em.cr...

Liquibase: How to execute Servlet Listener before EntityManager construction

I manage to issue a Liquibase Update as described in Liquibase Servlet Listener. <listener> <listener-class>liquibase.servlet.LiquibaseServletListener</listener-class> </listener> This effectively executes my Changelog. However, this happens after the setup of the EntityManager. Obviously, this is too late if I want my Persist...

Integrating JPA2.0 and Spring

Hello last few hours I try to test with spring jpa 2.0 3.0 Finally I could recover objects persisted but when I try to persist a new object I receive the following error message: org.springframework.dao.InvalidDataAccessApiUsageException: no transaction is in progress; nested exception is javax.persistence.TransactionRequiredExceptio...

Another tool like Ireport (JasperReport) that support ejbql connections

Hi, i'm been using ireport (jasperReport) for a lot of time, and everything goes fine until i begin to use ejbql connection, for this type of connection the ireport was not the best tool, And i Wanna know if there are another tool for reports based in java technology like ireport and also opensource. Thanks ...

Configure JDBC oracle specific property v$session.program using Jboss and JPA (hibernate)

I'd like to set the v$session.program Oracle property in order to have information available in the session table. I'm using JPA with a jndi XA datasource created with an oracle-xa-ds.xml deployed in the deploy folder of Jboss, and therefore I haven't access to the constructor of the Connection. I have access to the Connection object, in...

Hibernate joins every table in database

I've set up a small project as a test. I'm using BlazeDS and JPA with Hibernate on my test server, and flex with with dpHibernate to access the Java entities. Each Java entity extends BaseEntity, a class that contains ID and UUID fields. The Flex entities are created by DTO2FX. My problem is that, when I run the Flex project to try and ...

JBoss Seam Design Patterns?

I've really taken a liking to the JBoss Seam application framework. Since the notion of injection/outjection and tight integration between JSF/EJBs/JPA is relatively scarce among Java application frameworks, I was looking for some good resources for design patterns and best practices for using this framework. I've poured over the examp...

More than one relationship in two Hibernate Classes

Hibernate Gurus, I have a pesky issue and I don't really know how to solve my problem. I have a solution, however, I feel I may be reinventing the wheel. I have two entities, The first is a User Object, The second is an Alias Object. The relationship between the two is that A USER can have multiple ALIAS(es) and an ALIAS can be tied to...

Keeping JPA EntityManager open?

I am learning JPA and the general pattern in examples seems to be as follows: EntityManager em = factory.createEntityManager(); em.getTransaction().begin(); // .... em.getTransaction().commit(); em.close(); Now I am wondering why do we continually create and close EntityManagers, as opposed to keeping it open and just starting new tra...

JPA: How to have one-to-many relation of the same Entity type.

There's an Entity Class "A". Class A might have children of the same type "A". Also "A" should hold it's parent if it is a child. Is this possible? If so how should I map the relations in the Entity class? ["A" has an id column.] ...

Storing a Map<String,String> using JPA

I am wondering if it is possible using annotations to persist the attributes map in the following class using JPA2 public class Example { long id; // .... Map<String, String> attributes = new HashMap<String, String>(); // .... } As we already have a pre existing production database, so ideally the values of attributes ...

Hibernate Serialization Exception in GWT but Eclipselink not

Dear members, I am using eclipselink JPA implementation (Entity) with GWT 2.0 framework on presentation layer. Everything is working properly. But when i change my JPA implementation to Hibernate, I get Serialization/Deserialization Exception on GWT Layer when I pass entity beans but It is okay on eclipselink JPA. Whats really happens? H...

[GAE Java] Entity groups

Hey, I'm experimenting a bit with google app engine and the lack of a transaction di framework is missing. I'm implementing it as good as I can, but I'm hitting the same exception again and again: can't operate on multiple entity groups in a single transaction. found both Element... I have read the documentation (http://code.google.com/...

What happens to dereferenced hibernate (JPA) entities?

In a project i am working on, we have an EJB backend where various clients connect remotely (i.e. Web layer, web services layer, etc). The clients are on another machine and can be in another data center, so the front end and backend are never in the same app server. The backend is layered as follows: SLSB <-> Service Layer Objects <-...

how to obtain JSF app username from stateless session bean

Hello, in our app we use JSF & EJB 3.0 (EclipseLink 2.0). We need to use Oracle proxy authorization for every connection in our stateless session beans. For this we need to obtain DB username to connect throught proxy. DB username is constructed from JSF authenticated username by a rule. Here is an article on topic http://blogs.oracle.c...

entitymanager persist

I have a problem when trying to update foreign keys. Using the merge function I always get a out of memory error, or I get a timeout Fakultaet and Standort are foreign keys in the Raum table (many to one, and lazy fetching) Raum does eager fetching for the Fakultaet and Standort @Stateless @Local (IRaumHomeLocal.class) @Remote (IRaumHo...

entity manager merge method to update blob field

public void uploadFile(ActionEvent evt)throws Exception{ InputFile inputFile=(InputFile)evt.getSource(); byteArrayOutputStream=new ByteArrayOutputStream(); ObjectOutputStream objectOutputStream=new ObjectOutputStream(byteArrayOutputStream); objectOutputStream.writeObject(inputFile.getFile()); reportTemplate.setTemplatePa...

Multiple unique constraints in JPA

Is there a way to specify using JPA that there should be multiple unique constraints on different sets of columns? @Entity @Table(name="person", uniqueConstraints=@UniqueConstraint(columnNames={"code", "uid"})) public class Person { // Unique on code and uid public String code; public String uid; // Unique on us...

Specifying an index (non unique key) using JPA

How do you define a field, ie email as having an index using JPA annotations. We need a non-unique key on email because there are literally millions of queries on this field per day, and its a bit slow without the key. @Entity @Table(name="person", uniqueConstraints=@UniqueConstraint(columnNames={"code", "uid"})) public class Pe...