sexta-feira, 12 de fevereiro de 2016

Alterar o tamanho dos componentes do Primefaces

Coloque no head do seu template padrão.

   <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Meu Sistema</title>
         <style type="text/css">
            .ui-widget {
                font-size: 11px !important;
            }
        </style>        
    </h:head>

Oracle: REDOLOG LIMITE EXECEDIDO PARA ARQUIVOS DE RECUPERAÇÃO | limit exceeded for recovery files

Fonte: https://tamimdba.wordpress.com/tag/db_recovery_file_dest_size

C:\Documents and Settings\Administrator>sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jun 28 10:25:39 2010
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from tab;
select * from tab
              *
ERROR at line 1:
ORA-01219: database not open: queries allowed on fixed tables/views only
 
Shutdown the database first
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.

Start the database
SQL> startup
ORACLE instance started.

Total System Global Area  599785472 bytes
Fixed Size                  1250356 bytes
Variable Size             180358092 bytes
Database Buffers          411041792 bytes
Redo Buffers                7135232 bytes
Database mounted.
ORA-16038: log 2 sequence# 135 cannot be archived
ORA-19809: limit exceeded for recovery files
ORA-00312: online log 2 thread 1:
'F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG'

Problem: The value db_recovery_file_dest_size is not enough for generate archive log

          
SQL> show parameter DB_RECOVERY_FILE_DEST_SIZE;

NAME                                 TYPE        VALUE
------------------------------------ ----------- -------------------
db_recovery_file_dest_size           big integer 2G

Solution: Increase the value of db_recovery_file_dest_size following way.

 
SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 10G;

System altered.

Now open the database.

SQL> alter database open;

Database altered.

segunda-feira, 1 de fevereiro de 2016

org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags

Adicione a notação @Fetch(FetchMode.SELECT)

@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@Fetch(FetchMode.SELECT)
@JoinTable(
name="analista_grupoempresa",
joinColumns=@JoinColumn(name="grupoempresa_id"),
inverseJoinColumns=@JoinColumn(name="analista_id")
)
private List<Analista> analistas = new ArrayList<Analista>();

quinta-feira, 28 de janeiro de 2016

Java EE + Hibernate Lazy load exception

http://stackoverflow.com/questions/10579608/java-ee-6-hibernate-lazy-load-exception Java SE + JAVA EE http://uaihebert.com/quatro-solucoes-para-lazyinitializationexception/7/

quarta-feira, 13 de janeiro de 2016

Atualizar title usando JSF 2 e AJX / Render page title using jsf 2 and AJAX



<h:form id="titleForm">
     <title>#{loginMB.title}</title>
</h:form>

<a4j:poll interval="60000" render="titleForm" status="ajaxStatus">
     <f:setPropertyActionListener value="LpcSys (#{bean.baixasPendentes})" target="#{loginMB.title}"/>
</a4j:poll>

Fonte: http://stackoverflow.com/questions/11153010/updating-title-text-in-javaserver-faces-2-primefaces-3-3-1

segunda-feira, 11 de janeiro de 2016

Hibernate - A collection with cascade=”all-delete-orphan” was no longer referenced by the owning entity instance

      public void save(ActionEvent event) {  
           dao = new InboxFinanceiroDao<Inbox>(HibernateUtil.getSession(),Inbox.class);  
           desativarTab = false;  
           try {  
                dao.save(inbox);  
                dao.refresh(inbox); // Adicione essa linha após persistir o objeto.
           } catch (Exception e) {  
                
           }  
      }  

quarta-feira, 9 de dezembro de 2015

Hibernate: Ordenar lista por propriedade de objeto.

Ordenar lista por propriedade de objeto.

Deve-se utilizar o nome do join criado pelo Hibernate (posicaoflp1_). Para ver o nome basta ativar a exibição de SQL no arquivo hibernate.conf.

<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>

public class Processo implements Serializable,Cloneable {

     @OrderBy("posicaoflp1_.ordem desc")
     @NotAudited
     protected Collection<Followup> followup;
}

public class Followup implements Serializable, Cloneable {

@OneToOne
@JoinColumn(name="posicaoflp_id")
private PosicaoFlp posicaoFlp;
}

public class PosicaoFlp implements Serializable{
     private Integer ordem; // Ordenar por esse campo
}


SQL gerada pelo Hibernate: left outer join posicaoflp posicaoflp1_ on followup0_.posicaoflp_id=posicaoflp1_.id