I'm using HikariCP 3.3.1 and PostgreSQL. But I've a problem with closing my connections, in Hikari config I set maximum pool size to 15 and minimum idle connection to 5, but after a few minutes of work with database I've found out connections don't closes, they stack more and more (almost 100 Idle connections right now).

My Connector class:
Connector.java
public class Connector implements IConnector {
private static HikariConfig config = new HikariConfig();
private static HikariDataSource ds;
static {
config.setDriverClassName(org.postgresql.Driver.class.getName()); …Run Code Online (Sandbox Code Playgroud) 我正在尝试在现有的 AndroidTV 应用程序中使用 Jetpack Compose。我需要制作一个带有麦克风图标的按钮,如果它聚焦,它的颜色就会改变。像这样^
不专心
专注
这是我的 ComposeView
<androidx.compose.ui.platform.ComposeView
android:id="@+id/micBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
Run Code Online (Sandbox Code Playgroud)
这是我的片段中的代码
binding.micBtn.setContent {
var buttonResId by remember { mutableStateOf(R.drawable.speech_recognition_button_unfocused) }
IconButton(
modifier = Modifier
.size(60.dp)
.onFocusChanged {
buttonResId = if (it.isFocused) {
R.drawable.speech_recognition_button_focused
} else {
R.drawable.speech_recognition_button_unfocused
}
},
onClick = onClick,
) {
Icon(
painter = painterResource(id = buttonResId),
contentDescription = null,
tint = Color.Unspecified,
)
}
}
Run Code Online (Sandbox Code Playgroud)
看起来不错,对吧?问题是,当我尝试关注此按钮时,焦点首先转到AndroidComposeView项目(根据我的GlobalFocusListener)。只有我的第二个操作(单击、方向键导航)才能使我的内容集中。
所以,出于某种原因,内部AndroidComposeView窃取了我的注意力Content
有什么办法可以防止这种行为吗?我只需要关注我的内容,而不是AndroidComposeView包装。
android android-tv android-jetpack-compose android-jetpack-compose-tv
我有带有 @Entity 注释的用户类。
@Entity
public class User{
@Id
@GeneratedValue
private Long id;
private String firstName;
private String lastName;
}
Run Code Online (Sandbox Code Playgroud)
我需要创建另一个包含用户详细信息的表。它必须链接到 User_id 并且没有自己的 id:
user_id phone_number address
所以,现在我用这个:
@Entity
@Table
@Data
public class UserDetails{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(nullable = false)
private Long id;
@OneToOne (fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@PrimaryKeyJoinColumn
private User user;
private String address;
private String phone;
}
Run Code Online (Sandbox Code Playgroud)
但我有一个问题:为什么我用这个:
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(nullable = false)
private Long id;
Run Code Online (Sandbox Code Playgroud)
如果
@OneToOne (fetch = FetchType.EAGER, cascade = CascadeType.ALL) …Run Code Online (Sandbox Code Playgroud) java ×2
android ×1
android-tv ×1
datasource ×1
hibernate ×1
hikaricp ×1
postgresql ×1
spring ×1
spring-boot ×1