-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: org.hibernate.property.BasicPropertyAccessor joined table
PostPosted: Tue Aug 20, 2013 3:12 pm 
Newbie

Joined: Tue Aug 20, 2013 2:54 pm
Posts: 1
Location: Paraguay
Hi all

I got this error I can't figure out what's going wrong

by default, when entities were generated, the joined values were only "nullable = false, updatable = true", then I changed with the ones below

these are my entities

SystemUser
=========
Code:
package py.com.icarusdb.auras.model.common;

// Generated Aug 20, 2013 9:23:10 AM by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Properties;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import py.com.icarusdb.entity.EntityInterface;
import py.com.icarusdb.util.IDBProperties;

/**
* SystemUser generated by hbm2java
*/
@Entity
@Table(name = "system_user", schema = "public")
public class SystemUser implements EntityInterface
{
    private static final String GENERATOR = "SYSTEM_USER_ID_GENERATOR";

    private Long id;
    private Persona persona;
    private String username;
    private String password;
    private boolean active;
    private Set<Role> roles = new HashSet<Role>(0);

    @Id
    @SequenceGenerator(name = GENERATOR, sequenceName = "system_user_id_seq", allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = GENERATOR)
    @Column(name = "id", unique = true, nullable = false)
    public Long getId()
    {
        return this.id;
    }

    public void setId(Long id)
    {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "persona_id", nullable = false)
    public Persona getPersona()
    {
        return this.persona;
    }

    public void setPersona(Persona persona)
    {
        this.persona = persona;
    }

    @Column(name = "username", nullable = false, length = 10)
    public String getUsername()
    {
        return this.username;
    }

    public void setUsername(String username)
    {
        this.username = username;
    }

    @Column(name = "password", nullable = false, length = 30)
    public String getPassword()
    {
        return this.password;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    @Column(name = "active", nullable = false)
    public boolean isActive()
    {
        return this.active;
    }

    public void setActive(boolean active)
    {
        this.active = active;
    }

    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "user_rol", schema = "public",
               joinColumns = { @JoinColumn(name = "id_user", nullable = false, updatable = true, insertable = true) },
               inverseJoinColumns = { @JoinColumn(name = "id_rol", nullable = false, updatable = true, insertable = true) }
    )
    public Set<Role> getRoles()
    {
        return this.roles;
    }

    public void setRoles(Set<Role> roles)
    {
        this.roles = roles;
    }

    @Override
    @Transient
    public Properties getProperties()
    {
        Properties properties = new IDBProperties();
        properties.put(SystemUser_.id, getId());
       
        return properties;
    }

}


Role
===
Code:
package py.com.icarusdb.auras.model.common;

// Generated Aug 20, 2013 9:23:10 AM by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
* Role generated by hbm2java
*/
@Entity
@Table(name = "rol", schema = "public")
public class Role implements java.io.Serializable
{
    private static final String GENERATOR = "ROLE_ID_GENERATOR";

    private Long id;
    private String name;
    private boolean active;
    private Set<SystemUser> systemUsers = new HashSet<SystemUser>(0);

    @Id
    @SequenceGenerator(name = GENERATOR, sequenceName = "rol_id_seq", allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = GENERATOR)
    @Column(name = "id", unique = true, nullable = false)
    public Long getId()
    {
        return this.id;
    }

    public void setId(Long id)
    {
        this.id = id;
    }

    @Column(name = "name", nullable = false, length = 50)
    public String getName()
    {
        return this.name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    @Column(name = "active", nullable = false)
    public boolean isActive()
    {
        return this.active;
    }

    public void setActive(boolean active)
    {
        this.active = active;
    }

    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "user_rol", schema = "public",
               joinColumns = { @JoinColumn(name = "id_rol", nullable = false, updatable = false, insertable=true) },
               inverseJoinColumns = { @JoinColumn(name = "id_user", nullable = false, updatable = false, insertable=true) }
    )
    public Set<SystemUser> getSystemUsers()
    {
        return this.systemUsers;
    }

    public void setSystemUsers(Set<SystemUser> systemUsers)
    {
        this.systemUsers = systemUsers;
    }

    @Override
    public String toString()
    {
        return this.getName();
    }
}



the update method
==============
Code:
public String update(EntityInterface entity) throws Exception
    {
        try
        {
            try
            {
                utx.begin();
                em.merge(entity);
               
                logger.info("Updated " + getEntityInfo(entity));
            }
            finally
            {
                utx.commit();
            }
        }
        catch (Exception e)
        {
            try
            {
                utx.rollback();
            }
            catch (Exception ee)
            {
                ee.printStackTrace();
            }
            throw e;
        }
       
        return "updated";
    }


and the error itself (complete trace)
==============
Quote:
14:36:25,856 INFO [stdout] (http-localhost-127.0.0.1-8080-3) Hibernate:
14:36:25,860 INFO [stdout] (http-localhost-127.0.0.1-8080-3) select
14:36:25,863 INFO [stdout] (http-localhost-127.0.0.1-8080-3) systemuser0_.id as id177_0_,
14:36:25,866 INFO [stdout] (http-localhost-127.0.0.1-8080-3) systemuser0_.active as active177_0_,
14:36:25,871 INFO [stdout] (http-localhost-127.0.0.1-8080-3) systemuser0_.password as password177_0_,
14:36:25,873 INFO [stdout] (http-localhost-127.0.0.1-8080-3) systemuser0_.persona_id as persona5_177_0_,
14:36:25,876 INFO [stdout] (http-localhost-127.0.0.1-8080-3) systemuser0_.username as username177_0_
14:36:25,877 INFO [stdout] (http-localhost-127.0.0.1-8080-3) from
14:36:25,879 INFO [stdout] (http-localhost-127.0.0.1-8080-3) public.system_user systemuser0_
14:36:25,881 INFO [stdout] (http-localhost-127.0.0.1-8080-3) where
14:36:25,882 INFO [stdout] (http-localhost-127.0.0.1-8080-3) systemuser0_.id=?

14:36:25,896 INFO [stdout] (http-localhost-127.0.0.1-8080-3) Hibernate:
14:36:25,898 INFO [stdout] (http-localhost-127.0.0.1-8080-3) select
14:36:25,899 INFO [stdout] (http-localhost-127.0.0.1-8080-3) roles0_.id_user as id2_177_1_,
14:36:25,901 INFO [stdout] (http-localhost-127.0.0.1-8080-3) roles0_.id_rol as id1_1_,
14:36:25,903 INFO [stdout] (http-localhost-127.0.0.1-8080-3) role1_.id as id178_0_,
14:36:25,904 INFO [stdout] (http-localhost-127.0.0.1-8080-3) role1_.active as active178_0_,
14:36:25,906 INFO [stdout] (http-localhost-127.0.0.1-8080-3) role1_.name as name178_0_
14:36:25,907 INFO [stdout] (http-localhost-127.0.0.1-8080-3) from
14:36:25,909 INFO [stdout] (http-localhost-127.0.0.1-8080-3) public.user_rol roles0_
14:36:25,910 INFO [stdout] (http-localhost-127.0.0.1-8080-3) inner join
14:36:25,912 INFO [stdout] (http-localhost-127.0.0.1-8080-3) public.rol role1_
14:36:25,913 INFO [stdout] (http-localhost-127.0.0.1-8080-3) on roles0_.id_rol=role1_.id
14:36:25,915 INFO [stdout] (http-localhost-127.0.0.1-8080-3) where
14:36:25,917 INFO [stdout] (http-localhost-127.0.0.1-8080-3) roles0_.id_user=?

14:36:25,923 ERROR [org.hibernate.property.BasicPropertyAccessor] (http-localhost-127.0.0.1-8080-3) HHH000122: IllegalArgumentException in class: py.com.icarusdb.auras.model.common.Role, getter method of property: id
14:37:17,537 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) java.lang.IllegalStateException: BaseTransaction.rollback - ARJUNA016074: no transaction!

14:37:17,541 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.rollback(BaseTransaction.java:130)

14:37:17,543 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.rollback(BaseTransactionManagerDelegate.java:114)

14:37:17,546 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.rollback(ServerVMClientUserTransaction.java:175)

14:37:17,548 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

14:37:17,549 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

14:37:17,551 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

14:37:17,552 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at java.lang.reflect.Method.invoke(Method.java:601)

14:37:17,556 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)

14:37:17,557 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)

14:37:17,559 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)

14:37:17,560 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)

14:37:17,561 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.jboss.weld.bean.builtin.CallableMethodHandler.invoke(CallableMethodHandler.java:51)

14:37:17,563 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)

14:37:17,565 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)

14:37:17,568 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.jboss.weldx.transaction.UserTransaction$-751987745$Proxy$_$$_Weld$Proxy$.rollback(UserTransaction$-751987745$Proxy$_$$_Weld$Proxy$.java)

14:37:17,574 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at py.com.icarusdb.auras.data.DatabaseManager.update(DatabaseManager.java:128)

14:37:17,575 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at py.com.icarusdb.auras.data.DatabaseManager$Proxy$_$$_WeldClientProxy.update(DatabaseManager$Proxy$_$$_WeldClientProxy.java)

14:37:17,577 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at py.com.icarusdb.auras.controller.UserSettingsController.save(UserSettingsController.java:150)

14:37:17,579 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

14:37:17,580 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

14:37:17,582 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

14:37:17,584 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at java.lang.reflect.Method.invoke(Method.java:601)

14:37:17,585 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.apache.el.parser.AstValue.invoke(AstValue.java:262)

14:37:17,590 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)

14:37:17,592 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)

14:37:17,593 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)

14:37:17,595 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)

14:37:17,596 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)

14:37:17,598 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)

14:37:17,600 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at javax.faces.component.UICommand.broadcast(UICommand.java:315)

14:37:17,602 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)

14:37:17,603 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)

14:37:17,604 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)

14:37:17,605 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

14:37:17,606 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

14:37:17,608 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)

14:37:17,609 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

14:37:17,611 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

14:37:17,612 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)

14:37:17,613 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

14:37:17,615 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

14:37:17,617 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

14:37:17,618 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

14:37:17,619 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)

14:37:17,621 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

14:37:17,622 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

14:37:17,623 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

14:37:17,624 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

14:37:17,627 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

14:37:17,628 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

14:37:17,629 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

14:37:17,631 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

14:37:17,633 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) at java.lang.Thread.run(Thread.java:722)



Quote:
Hibernate default with JBoss AS 7.1.1
JDK 1.7.0_17
Windows 7


_________________
Betto McRose
Gonna get ya... no matter how far

JBoss 7.1.1 / Hibernate 4 / JSF 2 / Primefaces 3.5

mcrose@icarusdb.com.py


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.