Member Avatar

Hi, I have a scenario where I have 2 labels that need to be configured. The names of the labels are 'Out Data' and 'In Data'. I only have one field in the database called 'Data'. Whether it is 'Out' or 'In' is decided at the runtime by the value of an Enum 'Scenario'. However, I need to actually show the user Out Data&In Data so that he can select 1 or both of them. I heard that calculated field concept it JPA will assist in this. Is this true or is there some other way that I can achieve …

Member Avatar
0
17
Member Avatar

I have user login info stored with JPA along with a room. The room has a list of users, the users have a transient field, which is where my problem is coming in. @Entity public class User{ //some other stuff ids and such @Id @GeneratedValue(generator = "increment") @GenericGenerator(name = "increment", strategy = "increment") public Long getId() { return id; } @ManyToOne public Room getCurrentRoom() { return currentRoom; } public void setCurrentRoom(Room currentRoom) { this.currentRoom = currentRoom; } @Transient private BlockingDeque<Message> getMessages() { return messages; } private void setMessages(BlockingDeque<Message> messages) { this.messages = messages; } } @Entity public class Room implements …

Member Avatar
0
22
Member Avatar

Hi, I would like to load the data from a SOAP response XML file to a MySQL table. Sample SOAP XML would be http://data.gov.in/sites/default/files/Ashgourd_2012.xml. I have to write a program to populate the data. I'm not very familiar with Java Web Services. I've worked with Struts2 and basics of Spring. I'm in a situation to finish this XML to MySQL in one day. Please let me know which technologies (Spring WS, Hibernate(JPA), JAXB, JAX WS etc) to use and if possible put the code snippets as well. Thanks in advance

Member Avatar
0
12
Member Avatar

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" p:packagesToScan="jpatest.engine"> <property name="dataSource"> <bean class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="org.firebirdsql.jdbc.FBDriver" /> <property name="url" value="jdbc:firebirdsql://localhost:3050/testdb" /> <property name="username" value="xxxxxxxx" /> <property name="password" value="yyyyyy" /> </bean> </property> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="database" value="DEFAULT" /> <property name="showSql" value="true" /> <property name="databasePlatform" value="org.hibernate.dialect.FirebirdDialect" /> </bean> </property> <property name="loadTimeWeaver"> <bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" /> </property> <property name="jpaProperties"> <props> <prop key="hibernate.hbm2ddl.auto">update</prop> </props> </property> </bean> I have the following bean definition in my Spring application context, this gets loaded nicely and runs well. Now, I may have the requirement to rewire this on the fly to point to a different database. Is there any way to achieve …

Member Avatar
1
20
Member Avatar

I'm using Netbeans 7, JEE project with application client, stateless ejb with remote interface, and JPA entity clasess made from sql script. Interfaces are in separate library project which is referenced in ejb and client project. **And the problem is the remote method that use custom interface object made from entity class cannot be returned. Serialized probably.** Remote methods that use standard types work properly. You can look exceptions at the error code: Exception in thread "AWT-EventQueue-0" javax.ejb.EJBException: java.rmi.RemoteException: CORBA NO_IMPLEMENT 1398079489 Maybe; and this one: Caused by: java.lang.ClassNotFoundException: entity_klase.Varalica (no security manager: RMI class loader disabled) I'm suspecting that …

0
2
Member Avatar

I'm trying to create a jUnit test for my EJB's and if my app just contains a few beans everything's all good but as soon as I incorporate JPA and entity-classes my jUnit test blows up. My test fails at ejbContainer = javax.ejb.embeddable.EJBContainer.createEJBContainer(); and the stack trace says the following: > apr 03, 2012 6:28:05 FM org.glassfish.deployment.admin.DeployCommand execute SEVERE: Exception while preparing the app : Invalid resource : robbandsresor__pm com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : robbandsresor__pm I'm using NetBeans 7.1 and GlassFish 3.1.x (and jUnit 4) and this is a simple web application, and my Persistency Unit was created by NetBeans wizard …

Member Avatar
0
2
Member Avatar

Hi, I'm having a problem getting the auto generated ID immediately upon commit. I have an entityBean mapping like this: [CODE] @GeneratedValue(strategy=GenerationType.AUTO, generator="SEQ_SETTLEMENT_TRANS") @SequenceGenerator(sequenceName="SEQ_SETTLEMENT_TRANS", name="SEQ_SETTLEMENT_TRANS") @Id @Column(name="SET_TRANS_ID") private long setTransId; [/CODE] and I am trying to get the Id like this: [CODE]setEntityManager(PersistenceManager.getEntityManager()); getEntityManager().getTransaction().begin(); getEntityManager().persist(settlementTrans); getEntityManager().flush(); getEntityManager().getTransaction().commit(); System.out.println("ID :: "+settlementTrans.getSetTransId()); [/CODE] I'm using Oracle database and I created a sequence and a trigger for my table. What seems to be happening is that the sequence is triggered twice giving me a different ID from what is saved in the database. Example:: I would retrieve an ID = 10 and the object …

0
1
Member Avatar

I am using JPQL to write queries. I have an SQL as [CODE] SELECT * FROM `powergenerationdatapoint` AS pgdp INNER JOIN ( SELECT MAX( TIMESTAMP ) TIME FROM powergenerationdatapoint GROUP BY solarpanel_id )maxtime ON pgdp.timestamp = maxtime.time WHERE solarpanel_id IN ( SELECT id FROM solarpanel WHERE solar_plant_id =1 ) GROUP BY solarpanel_id [/CODE] This is query with Subquery in JOIN. How do I write this in JP QL

Member Avatar
0
4

The End.