: org.hibernate.exception.SQLGrammarException: could not load an entity

pessoALL, estou com esta duvida, quando eu tento atuallizar fazer uma persistencia no banco esta dando este erro , n sei o que esta acontecendo, alguem poderia me ajudar

08/10/2009 15:30:55 WARN [http-8080-2] (JDBCExceptionReporter.java:77) - SQL Error: 0, SQLState: 42883
08/10/2009 15:30:55 ERROR [http-8080-2] (JDBCExceptionReporter.java:78) - ERRO: operador não existe: character = bigint
Dica: Nenhum operador corresponde com o nome e o(s) tipo(s) de argumento(s) informados. Você precisa adicionar conversões de tipo explícitas.
Posição: 1265
08/10/2009 15:30:55 INFO [http-8080-2] (DefaultLoadEventListener.java:111) - Error performing load command
org.hibernate.exception.SQLGrammarException: could not load an entity: [br.ueg.entidade.Operador#74]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1874)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3044)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:229)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:120)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)
at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:677)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:661)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:665)
at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:228)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:358)
at $Proxy23.merge(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:198)
at $Proxy23.merge(Unknown Source)
at br.ueg.persistencia.dao.GenericDAOJPA.atualizar(GenericDAOJPA.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy30.atualizar(Unknown Source)
at br.ueg.negocio.impl.OperadorNegImpl.atualizar(OperadorNegImpl.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy36.atualizar(Unknown Source)
at br.ueg.view.OperadorMB.desbloquearOperador(OperadorMB.java:138)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.el.parser.AstValue.invoke(AstValue.java:131)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
at javax.faces.component._MethodExpressionToMethodBinding.invoke(_MethodExpressionToMethodBinding.java:78)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:57)
at javax.faces.component.UICommand.broadcast(UICommand.java:141)
at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
at org.ajax4jsf.component.UIDataAdaptor.broadcast(UIDataAdaptor.java:1364)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:409)
at org.apache.myfaces.lifecycle.ApplyRequestValuesExecutor.execute(ApplyRequestValuesExecutor.java:32)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:151)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:100)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:112)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.postgresql.util.PSQLException: ERRO: operador não existe: character = bigint
Dica: Nenhum operador corresponde com o nome e o(s) tipo(s) de argumento(s) informados. Você precisa adicionar conversões de tipo explícitas.
Posição: 1265
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:271)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1860)
… 102 more
08/10/2009 15:30:55 ERROR [http-8080-2] (TransactionAspectSupport.java:362) - Application exception overridden by commit exception
br.ueg.excecoes.AtualizarException: org.hibernate.exception.SQLGrammarException: could not load an entity: [br.ueg.entidade.Operador#74]
at br.ueg.persistencia.dao.GenericDAOJPA.atualizar(GenericDAOJPA.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy30.atualizar(Unknown Source)

---------------- MEU BANCO ---------------------

– Table: operador

– DROP TABLE operador;

CREATE TABLE operador
(
id bigserial NOT NULL,
senha “char”,
“listaGrupos” “char”,
bloqueado boolean NOT NULL DEFAULT false,
CONSTRAINT id PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE operador OWNER TO postgres;

– Table: pessoa

– DROP TABLE pessoa;

CREATE TABLE pessoa
(
id bigserial NOT NULL,
nome character(60) NOT NULL,
cpf character(11) NOT NULL,
email character(70),
data_nasc date,
registro_geral character(30) NOT NULL,
sexo integer NOT NULL,
foto integer,
sem_digital boolean DEFAULT false,
endereco character(30),
CONSTRAINT pessoa_pkey PRIMARY KEY (id),
CONSTRAINT pessoa_foto_fkey FOREIGN KEY (foto)
REFERENCES foto (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
OIDS=FALSE
);
ALTER TABLE pessoa OWNER TO postgres;

ESTOU USANDO SPRING + HIBERNATE, ESTA TUDO MAPEADO.

acho que o problema esta em que seu banco de dados tem o Registro Geral, que é char(30) e voce esta tentando colocar num campo INT. posta pra gente suas entidades java, so os atributos e nomes das classes.

   @Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long getId() {
    return this.id;
}
public void setId(Long id) {
    this.id = id;
}

@Column(name = "nome", unique = false, nullable = false, insertable = true, updatable = true, length=60)
public String getNome() {
    return nome;
}    
public void setNome(String nome) {
    this.nome = nome;
}

@Column(name = "cpf", unique = false, nullable = false, insertable = true, updatable = true, length=14)
public String getCpf() {
    return cpf;
}    
public void setCpf(String cpf) {
    this.cpf = cpf;
}

@Column(name = "email", unique = true, nullable = true, insertable = true, updatable = true, length=70)
public String getEmail() {
    return email;
}    
public void setEmail(String email) {
    this.email = email;
}

@Temporal(TemporalType.DATE)
@Column(name = "data_nasc", unique = false, nullable = true, insertable = true, updatable = true)
public Date getDataNasc() {
    return dataNasc;
}    
public void setDataNasc(Date nascimento) {
    this.dataNasc = nascimento;
}

@Column(name = "registro_geral", unique = false, nullable = false, insertable = true, updatable = true, length = 30)
public String getRegistroGeral() {
    return registroGeral;
}    
public void setRegistroGeral(String registroGeral) {
    this.registroGeral = registroGeral;
}

@Column(name = "sexo", unique = false, nullable = false, insertable = true, updatable = true)
@Enumerated(EnumType.ORDINAL)
public GeneroEnum getSexo() {
    return sexo;
}    
public void setSexo(GeneroEnum sexo) {
    this.sexo = sexo;
}
    
@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
@JoinColumn(name = "foto", unique = false, nullable = true, insertable = true, updatable = true)
public Foto getFoto() {
    return foto;
}
public void setFoto(Foto foto){
	this.foto= foto;
}

@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.EAGER)     
@JoinColumn(name = "endereco", unique = false, nullable = true, insertable = true, updatable = true)
public Endereco getEndereco() {
    return endereco;
}    
public void setEndereco(Endereco endereco) {
    this.endereco = endereco;
}

@Transient
@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER)     
@JoinColumn(name = "lista_mao", unique = false, nullable = true, insertable = true, updatable = true)
public Set<Mao> getListaMao() {
    return listaMao;
}    
public void setListaMao(Set<Mao> listaMao) {
    this.listaMao = listaMao;
}

@Column(name = "sem_digital", unique = false, nullable = true, insertable = true, updatable = true)
public boolean isSemDigital(){
    return this.semDigital;
}
public void setSemDigital(boolean semDigital){
    this.semDigital= semDigital;
}    

}

poste a classe Operador! É nela que tem o erro… algum tipo errado em relacao ao mapeamento do banco de dados.

Nao precisa por os getters e setters

abracos

@Entity
@Table(name=“operador”)
public class Operador extends Pessoa implements Serializable {
public static final long serialVersionUID = 24L;

private String senha;

private boolean bloqueado;

private List<Telefone> telefone;
private List<Grupos> listaGrupos;

@Override
public String toString() {
    return "id=" + getId();
}

@Column(name = "senha", unique = false, nullable = true, insertable = true, updatable = true, length=10)
public String getSenha() {
    return senha;
}    
public void setSenha(String senha) {
    this.senha = senha;
}

@Column(name = "bloqueado")
public boolean isBloqueado() {
    return bloqueado;
}    
public void setBloqueado(boolean bloqueado) {
    this.bloqueado = bloqueado;
}

@Transient
@OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
@JoinColumn(name = "telefone", unique = false, nullable = true, insertable = true, updatable = true)
public List<Telefone> getTelefone() {
    return telefone;
}    
public void setTelefone(List<Telefone> telefone) {
    this.telefone = telefone;
}

@OneToMany(cascade={},fetch=FetchType.LAZY)     
@JoinColumn(name = "listaGrupos", unique = false, nullable = false, insertable = true, updatable = true)
public List<Grupos> getListaGrupos() {
    return listaGrupos;
}
public void setListaGrupos(List<Grupos> listaGrupos) {
    this.listaGrupos = listaGrupos;
}

}

COLOQUEI TUDO AI , PQ OPERADOR EXTENDS PESSOA.

CREATE TABLE operador
(
id bigserial NOT NULL,
senha “char”,
“listaGrupos” “char”,
bloqueado boolean NOT NULL DEFAULT false,
CONSTRAINT id PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE operador OWNER TO postgres;

Fala Talles,

Como já lhe falei por e-mail, é necessário ver o relacionamento de herança que você está usando. O manual do hibernate annotations fala sobre os tipos de mapeamento:
http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#d0e829

Então, relacionado a isso você pode inserir uma identificação de chave primária na sua classe para fazer o Join.

@Entity
@Table(name="operador")
@PrimaryKeyJoinColumn(name="id")
public class Operador extends Pessoa implements Serializable { 
    ....
}

Tenta algo do tipo e depois fala o resultado…

paulo junior e paulo silveira o problema foi resolvido, quero agredecer a atencao de vcs…
pricipalmente ao paulo junior que tivemos muito tempo de papo para tentar resolver o problema, foi resolvido depois de muita tentativa,
fui removendo um por um , ate chegar a este campo . estava faltando a referencia da tabela foto.

Entidade pessoa

@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
@JoinColumn(name = “foto”, unique = false, nullable = true, insertable = true, updatable = true)
public Foto getFoto() {
return foto;
}
public void setFoto(Foto foto){
this.foto= foto;
}

CREATE TABLE pessoa
(
id serial NOT NULL,
nome character(60) NOT NULL,
cpf character(11) NOT NULL,
email character(70),
data_nasc date,
registro_geral character(30) NOT NULL,
sexo integer,
endereco integer,
sem_digital boolean DEFAULT false,
foto integer,
CONSTRAINT pessoa_pkey PRIMARY KEY (id),
CONSTRAINT pessoa_endereco_fkey FOREIGN KEY (endereco)
REFERENCES endereco (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT pessoa_foto_fkey FOREIGN KEY (foto) <------------------ AKIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
REFERENCES foto (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)

valewwww

[quote=talles_lopes]paulo junior e paulo silveira o problema foi resolvido, quero agredecer a atencao de vcs…
pricipalmente ao paulo junior que tivemos muito tempo de papo para tentar resolver o problema, foi resolvido depois de muita tentativa,
fui removendo um por um , ate chegar a este campo . estava faltando a referencia da tabela foto.

Entidade pessoa

@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
@JoinColumn(name = “foto”, unique = false, nullable = true, insertable = true, updatable = true)
public Foto getFoto() {
return foto;
}
public void setFoto(Foto foto){
this.foto= foto;
}

CREATE TABLE pessoa
(
id serial NOT NULL,
nome character(60) NOT NULL,
cpf character(11) NOT NULL,
email character(70),
data_nasc date,
registro_geral character(30) NOT NULL,
sexo integer,
endereco integer,
sem_digital boolean DEFAULT false,
foto integer,
CONSTRAINT pessoa_pkey PRIMARY KEY (id),
CONSTRAINT pessoa_endereco_fkey FOREIGN KEY (endereco)
REFERENCES endereco (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT pessoa_foto_fkey FOREIGN KEY (foto) <------------------ AKIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
REFERENCES foto (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)

valewwww
[/quote]

Olá tales, estou com um problema parecido com o seu. COmo eu não manjo de postgresql, eu gero minhas tabelas a partir de uma classe GeraBanco…
Estou tendo o seguinte erro:

org.postgresql.util.PSQLException: ERRO: operador não existe: bigint ~~ bigint Dica: Nenhum operador corresponde com o nome e o(s) tipo(s) de argumento(s) informados. Você precisa adicionar conversões de tipo explícitas. Posição: 317

minha tabela está assim:

[code]-- Table: programa

– DROP TABLE programa;

CREATE TABLE programa
(
cod_programa bigint NOT NULL,
nome character varying(255),
CONSTRAINT programa_pkey PRIMARY KEY (cod_programa)
)
WITH (OIDS=FALSE);
ALTER TABLE programa OWNER TO postgres;

– Table: servico

– DROP TABLE servico;

CREATE TABLE servico
(
cod_servico bigint NOT NULL,
nome character varying(255),
programa_cod_programa bigint,
CONSTRAINT servico_pkey PRIMARY KEY (cod_servico),
CONSTRAINT fk7643c6bf26b9a8f7 FOREIGN KEY (programa_cod_programa)
REFERENCES programa (cod_programa) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS=FALSE);
ALTER TABLE servico OWNER TO postgres;

– Table: unidade

– DROP TABLE unidade;

CREATE TABLE unidade
(
cod_unidade bigint NOT NULL,
abrangencia_arearural boolean,
abrangencia_estado boolean,
abrangencia_municipio boolean,
abrangencia_territorio boolean,
bairro character varying(255),
compartilhado boolean,
compartilhado_complemento character varying(255),
computador boolean,
computador_qtde character varying(255),
condicoesacessibilidade boolean,
email character varying(255),
endereco character varying(255),
endereco_complemento character varying(255),
fax character varying(255),
fone character varying(255),
funcionamento boolean,
impressora boolean,
impressora_qtde character varying(255),
internet boolean,
internet_cod_internet bigint,
mobiliario_adequado boolean,
modalidadeinstitucional_cod_modalidade bigint,
municipiosrr_cod_municipiosrr bigint,
nome character varying(255),
orgaogestor_cod_orgaogestor bigint,
predioexclusivo boolean,
programa_cod_programa bigint,
servico_cod_servico bigint,
telefone boolean,
telefone_complemento character varying(255),
transporte_proprio boolean,
usuario_cod_usuario bigint,
CONSTRAINT unidade_pkey PRIMARY KEY (cod_unidade)
)
WITH (OIDS=FALSE);
ALTER TABLE unidade OWNER TO postgres;
[/code]

Você ou alguem poderiam me ajudar?? Agradeço