小编Sem*_*lov的帖子

如何在Android中保存视图状态?

我正在开发app,我需要在ListView中显示建议,当方向改变时,我希望隐藏该列表.但它无论如何都出现在屏幕上.我试过这个:1)获取列表适配器并清除它.2)在方向改变之前设置可见性GONE(但在onCreate之后再次可见)3)在onCreate中设置可见性GONE,但列表仍然出现在屏幕上(我想也许android保存旧列表,因为我再次初始化列表视图,它看起来像空的,但屏幕上的列表不是).那么,我怎么能摆脱这个名单呢?

android state orientation

9
推荐指数
1
解决办法
5331
查看次数

使用JPA在Spring应用程序中嵌套事务(postgres)

是否有可能有PROPAGATION_NESTED@Transactional()使用JPA Postgres的?我正进入(状态:

org.springframework.transaction.NestedTransactionNotSupportedException:
JpaDialect does not support savepoints - check your JPA provider's capabilities
Run Code Online (Sandbox Code Playgroud)

我试过了:

@Bean
public PlatformTransactionManager transactionManager() {
    JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setEntityManagerFactory(entityManagerFactory()
                .getObject());
    transactionManager.setNestedTransactionAllowed(true);
    return transactionManager;
}
Run Code Online (Sandbox Code Playgroud)

但是没有成功。

java postgresql spring jpa transactions

5
推荐指数
1
解决办法
1758
查看次数

ISO C++禁止声明没有类型的"东西"

我是C++中模板编程的新手,所以我决定从编写模板列表开始.我得到的线这个错误Node<T> *head;,并Node<T> *tail;

这是我的头文件(因为错误只出现在那里):

#ifndef LIST_H
#define LIST_H

using namespace std;

template <class T> class List {

public:
    List();
    T get(const int n);
    void add(const T element);
private:
    Node<T> *head;
    Node<T> *tail;
    int size;
};

template <class T> class Node {
public :
    Node();
    T get();
    void setNext(const Node<T> *next);
    Node<T> getNext();
    void setValue(const T value);
private:
   T value;
   Node *next;
};

#endif // LIST_H
Run Code Online (Sandbox Code Playgroud)

哦,我typename之前尝试过添加Node<T>,但它给了我expected nested-name-specifier before 'Node'.

c++ templates

3
推荐指数
1
解决办法
2万
查看次数

Maven编译器插件错误:无法访问枚举(错误签名,坏类)

我正在使用maven-compiler-plugin:2.3.2,每次我ContentType在导入中有枚举()的类中进行更改时,我需要制作clean,否则它会给我:

ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project wp2: Compilation failure
[ERROR] /home/semyon/development/.../ContentManager.java:[15,46] error: cannot access ContentType
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project wp2: Compilation failure
/home/semyon/development/.../ContentManager.java:[15,46] error: cannot access ContentType

at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:364)
...
Run Code Online (Sandbox Code Playgroud)

ContentType是enum这样的:

import org.jetbrains.annotations.NotNull;

public enum ContentType {

    ...; 

    private final String title;

    private final boolean hasJad;

    private final CoreType coreType;

    private final String[] …
Run Code Online (Sandbox Code Playgroud)

java enums javac maven

3
推荐指数
1
解决办法
1460
查看次数

标签 统计

java ×2

android ×1

c++ ×1

enums ×1

javac ×1

jpa ×1

maven ×1

orientation ×1

postgresql ×1

spring ×1

state ×1

templates ×1

transactions ×1